Results 1 to 5 of 5

Thread: raise event after mouse click?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Posts
    362

    raise event after mouse click?

    Hi,


    I have a picturebox on the form, when it is clicked, I want the picturebox to fit the size of the form, which can be done by
    pic.SizeToFit = true

    So, the picturebox will automatically change the size.

    But after that, I want to set pic.SizeToFit = false , I need this because the picturebox is a user control which has a image Pannign feature, and it works only when the picturebox.SizeToFit = false

    Now, the problem is: I can not set it = false in the mouse click event, because I need set it = true, so the pic will change size.

    basically, what I need is: after mouse click event finished, change SizeToFit = false.

    One way to do it is in mouse click event, start a timer, after several seconds, set SizeToFit = false. Or, use a thread. It will work. But, is there a more elegant way to do this?

    thanks


    bear

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: raise event after mouse click?

    are you sure setting pic.SizeToFit = false won't resize the picturebox?
    you could use the _MouseUp event

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2004
    Posts
    362

    Re: raise event after mouse click?

    Quote Originally Posted by .paul. View Post
    are you sure setting pic.SizeToFit = false won't resize the picturebox?
    you could use the _MouseUp event
    because the picture box is a user control, not the original picture box, I'm sure size to fit = false will not change the size back.

    yes, I'll try hook the MouseUp. How come I forget it,

    thanks

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: raise event after mouse click?

    Because it isn't reliable? Still, it is worth testing. There are times when MouseUp doesn't get raised, though. Drag and Drop is one such occasion and there may be others, but it doesn't sound like you are doing Drag and Drop, so that probably doesn't matter. Testing is required, though.
    My usual boring signature: Nothing

  5. #5
    Junior Member
    Join Date
    Nov 2011
    Posts
    28

    Re: raise event after mouse click?

    Hi flyingBear ..... if you wanna set the picbox size back you have to save the dimensions and the location of the picbox in a global parameters ...... some thing like that
    vb Code:
    1. top=picbox.top
    2.     left=picbox.left
    3.     size=picbox.size
    And then you have you can reverse the operations

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