473,725 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# Forms: Custom UserControl mouse event handling

4 New Member
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.
-JT
Sep 6 '07 #1
3 2696
SammyB
807 Recognized Expert Contributor
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
Zabto
4 New Member
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.)

Thanks!
Sep 6 '07 #3
Plater
7,872 Recognized Expert Expert
(those are menus, ther'yre different)

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

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

Similar topics

5
11534
by: C. Alexander | last post by:
I'm trying to create a multi-user interactive whiteboard that has the ability to load a 'background' image to draw ontop of. The client/server needs to load a transparent layer for each user that connects. This is so the individual user layers can be cleared. Each layer is painted on by the user it is assigned to, so the layer must respond to mouse events.
2
1301
by: Nicole - ASP/C# Beginner | last post by:
I am trying to kick off an custom event in a usercontrol that the webpage will listen and preform some actions if the event is fired from within my usercontrol
15
10944
by: Tinus | last post by:
Hello all, I've created a custom control that draws a monthly schedule (using the Draw function in C#). Basically it draws 31 boxes and writes the day number in every box. This works great. But I now want to show a different tooltip for every day. For now I found out that I can add a tooltip for the entire custom control
0
2598
by: Joe | last post by:
Anyone have any experience using custom snaplines? I have a usercontrol that acts as a container for several child controls. I wrote an inherited ControlDesigner to handle some custom actions for this control, mainly to allow some resizing of the usercontrol's child controls inside the designer. All works well so far. Now I want to add a custom snapline that aligns to the edge of one of the internal controls. Done. If I move two of...
10
2424
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
9
7603
by: jon | last post by:
Hello, I'm trying to experiment with some javascript to do some custom dragdrop handling. I wish to use the onMouseDown event to trigger the start of my drag, and onMouseup for a potentential drop. I hope to turn on the onmouseup only in onmousedown. And eventually go one step further and incorporate onmousemove for a true drag workflow. I'm running into a problem however, where after mousedown, mouseup will not fire when I release...
0
1161
by: aparsons | last post by:
I have an MDI application in which I want the user to drag the child forms to put them in order. I will have to write some mouse handling code for that I know. However when you click on the child forms, before you even capture the mouse , they change their order! I want them to stay still and move only when the code tells them to. Try it! Just put this code into a default form1 - I'm using C# Express 2008. Then click on a child form and...
4
2486
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
6
1881
by: tshad | last post by:
I was looking at a page that showed how to set up a custom event and it seems to work ok. But I am not sure how I would use it. How would I subscribe to it. There is actual action (such as pressing a button or changing text in a textbox). It gets set up and on the user control on my web page I can see the event from intellisense. So it seems to be set up, but I am trying to get an easy example of how I would now use this event. ...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.