Results 1 to 14 of 14

Thread: make a porton of the form "draggable"

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    make a porton of the form "draggable"

    I decided to manually skin my app:



    The top bar, I don't know how to make it so when you hold your mouse on it, you can adjust it.

    Any ideas?
    It's a ShapeBox, and the images on top are image boxes. I can make adjustments easily. Thanks
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. Option Explicit
    2. 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
    3. Private Declare Sub ReleaseCapture Lib "User32" ()
    4. Const WM_NCLBUTTONDOWN = &HA1
    5. Const HTCAPTION = 2
    6.  
    7. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8.     Dim lngReturnValue As Long
    9.     If Button = vbLeftButton Then
    10.         Call ReleaseCapture
    11.         lngReturnValue = SendMessage(Form1.hWnd, WM_NCLBUTTONDOWN, _
    12.         HTCAPTION, 0&)
    13.     End If
    14. End Sub

    makes it possible to move a form without a titlebar.

    you need a hwnd, the shape and the images do not have that... not sure how to solve that..

    you could paint the title bar onto the form directly, then you could use the sample above directly
    -= a peet post =-

  3. #3

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    hmm thanks, ill play with it and see what i can do
    Last edited by nabeels786; Dec 28th, 2002 at 09:56 AM.
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    do that

    nice skinning btw
    -= a peet post =-

  5. #5

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    thanks

    i decided to put it in a label, i expanded it to its big enough, didnt do anything when i tried to drag it, it just snaps to the mouse position. the drag events are only if something is dragged over it right? or is the oledrag? i havent used vb in a while..lol
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    I was thinking more like the attached project shows.

    (I cheated a lot )
    -= a peet post =-

  7. #7
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    urk... was a bit bigger than expected...

    here, I uploaded it : http://www.pvp.no/vbw/move a boarderless form.zip
    -= a peet post =-

  8. #8

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    ohhhhhhhhhhhhhhh i see what you mean now. lemme try that out
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  9. #9

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    alrighty, sweet it working, thanks man

    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  10. #10
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    yay!
    -= a peet post =-

  11. #11
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    How did you skin those buttons? or is it pictureboxes ?
    -= a peet post =-

  12. #12

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    picture boxes
    i made the images in fireworks, and then just added them in

    the frames were shapes, and i just added the text in.
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  13. #13
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by peet
    makes it possible to move a form without a titlebar.

    you need a hwnd, the shape and the images do not have that... not sure how to solve that...
    I guess this is solved already, but I just thought I'd point out that only the form/control to be dragged needs an hWnd. The control you are using to drag it only needs to have a MouseMove event. You're still stuck on the shape control, since it doesn't have any events at all, but you can do this...
    VB Code:
    1. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Dim lngReturnValue As Long
    3.     If Button = vbLeftButton Then
    4.         Call ReleaseCapture
    5.         lngReturnValue = SendMessage(Form1.hWnd, WM_NCLBUTTONDOWN, _
    6.         HTCAPTION, 0&)
    7.     End If
    8. End Sub

    ...with an imagebox and it will work.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  14. #14

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    thanks blade. i did the code onto the imagebox that's the background nad then the label which is the title, so if you click in "idle" space itll be moveable

    thanks guys
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

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