Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to mazximize form without cover Toolbar

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
411
0
16
IT
how to mazximize form without cover Toolbar, with code?
Naturally WITHOUT Min Max button on title bar.
Tks.
 
What form? What toolbar? We need a little more info here, I think.

And what have you tried so far?
 
Private Sub Form_Activate()

Form1.WindowState = vbMaximized
Me.Text.SetFocus

End Sub

in form property have WindowState =0-normal

Actually the code cover my toolbar in image!
Immagine_w7qsww.gif
 
Ah, taskbar, that makes more sense.

Ok, well - that's expected behabviour. So you have to fake things a little for the effect you want. Make sure you set the form's BorderStyle to "0 - None" in the IDE

Code:
[blue]Option Explicit

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type

Private Sub Form_Activate()
    
    Dim DesktopArea As RECT

    Call SystemParametersInfo(SPI_GETWORKAREA, 0, DesktopArea, 0)
    
    DesktopArea.Top = DesktopArea.Top * Screen.TwipsPerPixelY
    DesktopArea.Bottom = DesktopArea.Bottom * Screen.TwipsPerPixelY
    DesktopArea.Right = DesktopArea.Right * Screen.TwipsPerPixelX
    DesktopArea.Left = DesktopArea.Left * Screen.TwipsPerPixelX
    
    Move DesktopArea.Left, DesktopArea.Top, DesktopArea.Right - DesktopArea.Left, DesktopArea.Bottom - DesktopArea.Top

End Sub[/blue]
 
Unfortunately, with "the form's BorderStyle to "0 - None" in the IDE" you will loose Title bar of the Form :-(
plus, if you have your Toolbar (Taskbar) set to "Auto-hide the Taskbar" - you are not gaining anything. The Form covers Taskbar's portion of the screen anyway...


---- Andy

There is a great need for a sarcasm font.
 
>"the form's BorderStyle to "0 - None" in the IDE" you will loose Title bar of the Form

You do indeed, but it is the quickest/cheapest way of hiding min and max buttons (and the controlbox) and preventing the window being moved - which I assumed was a goal from the requirement for removing the min and max buttons.

If a titlebar is required then we have to include border width and titlebar height in our calculations for desktop area - and probably subclass the window to capture WM_SYSCOMMAND's SC_MOVE

I am also assuming from the way the question is asked that the toolbar is being displayed, not autohidden.
 
>the quickest/cheapest way of hiding min and max buttons
You can set the MaxButton and MinButton (properties of the Form) to False

>preventing the window being moved
Another Form’s property: Movable set to False

Worth to give a try ... :)


---- Andy

There is a great need for a sarcasm font.
 
ok.
i have used various tipe of code. All work fine.
But really when i doubleclick on titlebar of form, the form is minimized!
In this case i need intercept the doubleclick on title bar of form!!!

test this on your one form, and see....

Othe way are welcome.
 
I've just tried strongm's code with the MaxButton and MinButton set to False, and Double_Click on Title bar of the Form does nothing. Form stays up, doesn't move, doesn't Minimize :)

>test this on your one form, and see....
For us to test it, we would need to know exactly what you have done. "various tipe of code" doesn't help


---- Andy

There is a great need for a sarcasm font.
 
>Worth to give a try ... smile

Sure - three settings to change, versus one! That's why I just said it was the cheapest way of doing it - but not the only way, obviously. And those three settings should achieve what the OP described. And, as you have already said, also address the double-click on the title bar issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top