Results 1 to 4 of 4

Thread: Drag and Drop

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2003
    Location
    CANADA
    Posts
    63

    Question Drag and Drop

    I have a non-rectangle form without title/caption bar. I wanna allow user to move the form by clicking on anywhere on the form and move it, how do i do that?

    Thanks for the help!

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You are going to probably have to use the mouse down event to enter a loop that polls where the mouse is and move the form.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2003
    Location
    CANADA
    Posts
    63
    this is what i will do...
    Code:
    Trap MouseDown:  
    set a flag stating the mouse is depressed, set the current 
    position of mouse (properties on the MouseEventArgs object). 
    
    Trap MouseMove:
    if flag is set, calculate the difference in the current position of the
    mouse & the previous position of the mouse and move the form 
    accordingly.  Set previous location to current location. 
    
    Trap Mouseup:  toggle the flag.
    but i dunno how to do this...


    set the current
    position of mouse (properties on the MouseEventArgs object)


    Trap MouseMove: if flag is set, calculate the difference in the
    current position of the mouse & the previous position of the
    mouse and move the form accordingly. Set previous location to
    current location.

    Last edited by session; May 18th, 2003 at 07:50 PM.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Maybe there is an equivalent in C# of catching WM_NCHITTEST?

    In any case, you could override PreProcessMessage.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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