469,909 Members | 1,748 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

C# Forms: Custom UserControl mouse event handling

I created an array of 8X5 boxes to represents pixels in a character. Each box is a custom UserControl of a fixed size which is filled black if it's activated, or white if it's not.

I wanted to change multiple boxes with a click and drag. On mouse down I toggle the value of the current box and then set two static variables for the class:

ButtonDown = true;
Activate = (true or false, depending upon which action was just taken.)

The idea being that I could then use the mouseEnter event on other boxes to check buttonDown and, if true, set the box to the same state as the source box for the click.

But MouseEnter doesn't fire for any other boxes in between the MouseDown and MouseUp events.

How do mark the mouse down event as handled so that MouseEnter works while I'm holding the button down?

Thanks for any ideas.
Sep 6 '07 #1
3 2428
807 Expert 512MB
JT, wouldn't it be better to have a single UserControl with a character size property that determines how many boxes are in the control. Seems like this would make the click and drag much easier. --Sam
Sep 6 '07 #2
That would solve it. I could do that and then just use mouseMove for a position to calculate which box I'm in... if mouseMove is raised when the button is down. I think it is.

It would still be good to know the way to implement it with separate controls (like clicking and holding the "file" drop down menu and sliding to "view", "edit", etc. Each of them pop down afterwards. I assume each of them would be their own sub control.)

Sep 6 '07 #3
7,872 Expert 4TB
(those are menus, ther'yre different)

You would probably have to check the DragEnter event in your situation
Sep 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Nicole - ASP/C# Beginner | last post: by
15 posts views Thread by Tinus | last post: by
reply views Thread by Joe | last post: by
4 posts views Thread by =?Utf-8?B?UmljaEI=?= | last post: by
6 posts views Thread by tshad | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.