Results 1 to 10 of 10

Thread: [RESOLVED] Custom form drag-bar

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Resolved [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 :-)

  2. #2

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    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"

  5. #5

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)

  7. #7
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Custom form drag-bar

    Quote 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.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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.

  9. #9
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    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:
    1. Private lngOldX As Long
    2. Private lngOldY As Long
    3. Private blnIsMoving As Boolean
    4.  
    5. Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    6.     lngOldX = X
    7.     lngOldY = Y
    8.     blnIsMoving = True
    9. End Sub
    10.  
    11. Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    12.     If blnIsMoving Then
    13.         Me.Top = Me.Top - (lngOldY - Y)
    14.         Me.Left = Me.Left - (lngOldX - X)
    15.     End If
    16. End Sub
    17.  
    18. Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    19.     blnIsMoving = False
    20. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
  •  



Click Here to Expand Forum to Full Width