[RESOLVED] Custom form drag-bar
Is there a way, if I set form-borderstyle to none, to put (for instance) a label or image at the top (or anywhere, for that matter) and make it control the form's location on-screen?
I can imagine an "on mousedown" event that notes the location which was clicked and if mouse moves form's top/left moves accordingly, but I don't know if I could write code that could handle this efficiently enough.
Also, could I do something like this on a form that is *embedded* within another form. I am currently thinking about designing a Windows 3.11 *style* OS (you know, just trying to build a basic OS look with functional design) in VB as a form with embedded forms within...I will of course only go as far as I feel I am able with a project like ths, so if it's a lot of work to do all the embedding and such I won't bother :-)
I know that certain aspects of VB allow for drag and drop, but that's not really what I am trying to do...I don't think, anyway...this is going to be a pet project of mine and mostly a playaround to see what I can achieve on my own and with help :-)
Re: [RESOLVED] Custom form drag-bar
here is the code I was talking about...
borderless form with a label across the top... u can drag the form with the label
VB Code:
Private lngOldX As Long
Private lngOldY As Long
Private blnIsMoving As Boolean
Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
lngOldX = X
lngOldY = Y
blnIsMoving = True
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnIsMoving Then
Me.Top = Me.Top - (lngOldY - Y)
Me.Left = Me.Left - (lngOldX - X)
End If
End Sub
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
blnIsMoving = False
End Sub
Re: [RESOLVED] Custom form drag-bar
Yeah, that was the sort of code I was thinking about using if I couldn't find anything specifically suited to what I wanted...I'll probably try both :-)