Is it possible to remove the border and titlebar of an mdi parent form in vb6? I've been searching the net for a way and have yet to find one. Any help would be much appreciated!
Printable View
Is it possible to remove the border and titlebar of an mdi parent form in vb6? I've been searching the net for a way and have yet to find one. Any help would be much appreciated!
Try this.
vb Code:
Option Explicit Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Const WS_CAPTION = &HC00000 Const WS_SYSMENU = &H80000 Const WS_MINIMIZEBOX = &H20000 Const WS_MAXIMIZEBOX = &H10000 Const GWL_STYLE = (-16) Private Sub MDIForm_Load() Dim L As Long L = GetWindowLong(Me.hwnd, GWL_STYLE) L = L And Not (WS_MINIMIZEBOX) L = L And Not (WS_MAXIMIZEBOX) L = L Xor WS_CAPTION L = SetWindowLong(Me.hwnd, GWL_STYLE, L) End Sub
How would you remove the single border from the above code? So that this removes the single boder and stop from resizing the MDIform.
I was looking to do the exact samething last night ... and eventually found the solution elsewhere :
just define another constant :
and use the following ( NB. you no longer need to "manually" remove the min and max boxes )Code:Const WS_THICKFRAME = &H40000
Code:Dim L As Long
L = GetWindowLong(Me.hwnd, GWL_STYLE)
L = L And Not (WS_THICKFRAME)
L = L Xor WS_CAPTION
L = SetWindowLong(Me.hwnd, GWL_STYLE, L)
works great! thanks!
as long as you dont have a statusbar on the form
i am using a mdiform with a statusbar on the bottom and now the resize function is moved to the statusbar, which looks funny, but is not what i want :)
i tried using the hwnd of the statusbar instead, but that didnt work either
does anyone have a clue how to create an mdiform which cant be resized and has no caption/controlbox and no border ?
That resize/grab handle on the status bar was always there, correct? I don't know if you can remove it without taking control over drawing the statusbar yourself and/or preventing mouse events over that corner. However, you can disable the statusbar which prevents users from dragging that corner.
Code:Private Declare Function EnableWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
' Example:
EnableWindow MDIForm1.StatusBar1.hwnd, 0& ' 0&=False, 1&=True
wow thats what i call a quick reply :)
the resize/grab handle was always there indeed, but normally it doesnt resize the statusbar itself. normally when you drag the handle the mdi form itself resizes
your code works great! thanks!
the resize/grab handle is still there but doesnt do anything anymore
:thumb::thumb:
double thumbs up
The StatusBar resize/grab handle is only visible if it's Align property is set to 2 - vbAlignBottom. You could add a PictureBox to the MDI form aligned to the bottom and then place the StatusBar in the PictureBox. Since the StatusBar is in the PictureBox it can no longer be Aligned. Use the PictureBoxes Resize event to adjust the StatusBar to completely fill the PictureBox client area.
Code:Private Sub Picture1_Resize()
StatusBar1.Move 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
End Sub
thanks! nice tip!
Thanks a lot bro:wave:
doss....you DO realize this is a 9 year old+ thread?????????????????????????????????