How do I hide a form's titlebar?
Setting ControlBox, MaxButton, etc. to false and Caption to nothing works, but I need to keep the caption in the taskbar.
Printable View
How do I hide a form's titlebar?
Setting ControlBox, MaxButton, etc. to false and Caption to nothing works, but I need to keep the caption in the taskbar.
set borderstyle to none(0)
By default, when you set the BorderStyle to 0-None, the ShowInTaskBar property changes to False, so make sure you set it back to True.
well I would keep it false, because when you dont have a title bar, it gets a little screwed up,
when you try to minimize the form(by clicking on the taskbar icon) nothing happens, you have to use your own minimize code,
which isnt really a problem, but it kind of bugs me I cant minimize it by clicking in the taskbar.
Set ControlBox, MinButton and Maxbutton to False and set the caption to " " instead of ""...
Mad Compie: But that will set the caption to " ". Setting the BorderStyle to None will still keep the original caption.
Yes indead, I missed the plot.
But you can create your own caption bar!
Make a form only have a border or something.
Draw your caption using AutoRedraw=True and Form.Print Method.
In your Form_MouseMove Event check the absolute X Y values, if between a certain range, then use the SendMessage() API to move your Form while holding the mouse button.
Yes, you could create a TitleBar, but in this case he wants to hide the TitleBar on the Form but still keeping it in the TaskBar. Setting the BorderStyle to 0-None will accomplish this.
Border Style = 3
Caption = ""
ControlBox = False
And Use..
Public X2 As Double, Y2 As Double
Public m_Down As Boolean
Private Sub Form1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
m_Down = True
X2 = X
Y2 = Y
end Sub
Private Sub Form1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (m_Down = True) Then
Me.Move Me.Left - (X2 - X), Me.Top - (Y2 - Y)
End If
End Sub
Private Sub Form1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
m_Down = False
End Sub
That should do it
this is a bit easier and Faster(uses API)
Code:Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Button
Case 1
ReleaseCapture
SendMessage Me.hwnd, 161, 2, 0
End Select
End Sub
and BTW your code doesnt even work.
Yes indeed, that's what I also had in mind.
"SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)"
thank you!
I never knew the constant names, just the value that was supposed to be in there.
You're welcome.
Try also http://www.allapi.net, which contains an excellent API viewer with a lot of sample codes! ("API Guide")
oh yeah, I have that, but half the declares arent there, because everytime I try to update the damn thing, it gets about half way and then it just stops.
If you want all off the documented API's, I suggest you download the Platform SDK, however, in order to read/understnad them, you must have an understanding of C/C++.
This is huge, this SDK from Bill. But I think that the 500MB download will slow down my system...