|
-
Jun 6th, 2006, 08:53 PM
#1
Thread Starter
PowerPoster
[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 :-)
-
Jun 6th, 2006, 09:11 PM
#2
Re: Custom form drag-bar
Search forum for ReleaseCapture() api and you will find many many sample code to move borderless form. For more advanced sample include my name in the user field.
-
Jun 6th, 2006, 09:19 PM
#3
Thread Starter
PowerPoster
Re: Custom form drag-bar
Thanks, that helped me find http://www.vbforums.com/showthread.p...ecapture%28%29 which seems to be perfect for the job if it works...simple to understand and short...just right for me :-)
I'll take a proper look tomorrow at other possibilities...I don't need anything too advanced, but I am basically looking at this with the intent of being able to skin windows like XP does (or like windowblinds does to XP :-))...something classy but functional is what I am aiming for...simple yet unique if possible :-)
-
Jun 6th, 2006, 09:25 PM
#4
Re: Custom form drag-bar
I have code at work for moving objects using other objects. fairly simple.. yet effective. if u dont have an answer by the am i will post it
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jun 6th, 2006, 09:36 PM
#5
Re: Custom form drag-bar
If you're after skinning then take a look @ vbAccelerator's NeoCaption control (full source is available) - it's worth visiting that place.
-
Jun 6th, 2006, 09:42 PM
#6
Thread Starter
PowerPoster
Re: Custom form drag-bar
Yeah, I've been to vbAccelerator a few times and tried out their code before...some of it's nice, but I kinda get the feeling that a lot of it is over-the-top eye-candy, if you know what I mean. Not that I'm putting the site down or anything, just too much bloat can kill a program :-)
I'll probably have a good look through their available code and see if any of them interest me or give me any ideas. I've got a few useful functions planned that programmers could use within their "forms" if they wished...I want to try to limit what I do with this to as little as possible so that it doesn't get too bogged down with half-finished and buggy functions that are no use to anyone :-)
-
Jun 6th, 2006, 09:53 PM
#7
Re: Custom form drag-bar
 Originally Posted by smUX
...it is over-the-top eye-candy, if you know what I mean. ...
No I don't exactly know what that mean. However, applying skins to your app usually creates the "eye-candy" with little functionality (or what I call "right between the eye) effect.
You're more than welcome to accept or deny any suggestion - this part is entirely upto you but don't underestimate the value of Steve Mac's samples that he provides for free to VB community world wide.
Best regards.
-
Jun 7th, 2006, 05:09 AM
#8
Thread Starter
PowerPoster
Re: Custom form drag-bar
Like I said, it's nothing against the site's code...I'm not saying that the code is useless in any way, just that *usually* it isn't my style of coding, that's all :-)
I've marked this thread as resolved despite not actually having achieved the objective...but I can't code at the moment so can't test it :-)
Last edited by smUX; Jun 7th, 2006 at 05:26 AM.
-
Jun 7th, 2006, 07:15 AM
#9
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
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jun 7th, 2006, 07:17 AM
#10
Thread Starter
PowerPoster
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 :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|