473,385 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Custom Control Mouse Events

Hello Everyone,

I designed a custom control that is entirely covered by a picture box.
I then dragged this custom control onto a windows form application
(called main) and I need to handle mouse events in my main
application. Specifically, when a user double clicks on my custom
control I need to draw something on another picture box located in my
main application.

I'm going to attempt to draw the scenario because I think it will
clarify my question so please bare with me!

-------------------------------------------------------------------------------------------
| Main
Form
|
--------------------------------------------------------------------------------------------
|
| -------------------------------
-------------------------------
| | |
| |
| | custom | | picture
box |
| | control | | on main
form |
| | |
| |
| | |
| |
| | |
| |
| | |
| |
| -------------------------------
-------------------------------
|
|
----------------------------------------------------------------------------------------------

What I need to be able to do as I mentioned above is somehow establish
communication between the
custom control and picture box. The problem is that because the custom
control is entirely covered by its OWN
picture box, whenever the user clicks on the control in the main form,
it doesn't do anything (because its picturebox is preventing it from
receiving mouse clicks.

Any ideas on how to get around this problem? I'd appreciate the help!

One solution might be to draw to the main picture box from the custom
control itself. Is that even possible? Can paint to the main picture
box through my custom control code?

Thanks for any help!

~ Maryam

Mar 7 '07 #1
2 3230
Hello Everyone,

I designed a custom control that is entirely covered by a picture box.
I then dragged this custom control onto a windows form application
(called main) and I need to handle mouse events in my main
application. Specifically, when a user double clicks on my custom
control I need to draw something on another picture box located in my
main application.

What I need to be able to do as I mentioned above is somehow establish
communication between the custom control and picture box.
The problem is that because the custom control is entirely covered by
its OWN
picture box, whenever the user clicks on the control in the main form,
it doesn't do anything (because its picturebox is preventing it from
receiving mouse clicks.

Any ideas on how to get around this problem? I'd appreciate the help!

One solution might be to draw to the main picture box from the custom
control itself. Is that even possible? Can paint to the main picture
box through my custom control code?

Thanks for any help!

~ Maryam
Mar 7 '07 #2
your control should inherit from the class System.Windows.Forms.Control.

<ah**********@gmail.com>
:11********************@8g2000cwh.googlegroups.com ...
Hello Everyone,

I designed a custom control that is entirely covered by a picture box.
I then dragged this custom control onto a windows form application
(called main) and I need to handle mouse events in my main
application. Specifically, when a user double clicks on my custom
control I need to draw something on another picture box located in my
main application.

What I need to be able to do as I mentioned above is somehow establish
communication between the custom control and picture box.
The problem is that because the custom control is entirely covered by
its OWN
picture box, whenever the user clicks on the control in the main form,
it doesn't do anything (because its picturebox is preventing it from
receiving mouse clicks.

Any ideas on how to get around this problem? I'd appreciate the help!

One solution might be to draw to the main picture box from the custom
control itself. Is that even possible? Can paint to the main picture
box through my custom control code?

Thanks for any help!

~ Maryam


Mar 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
15
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...
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
1
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
9
by: Rob | last post by:
When a custom control is used within a form, that control does not get events directly. I've run into this a couple times with both mouse and keyboard events. Ex: A custom control inherits from...
2
by: cefrancke | last post by:
Is there a way to capture all relevant info about the mouse, without using Mouse Up/Down etc. procedures? I'm trying to make a custom function and send it the mouse info on the click event. ...
2
by: Jay Dee | last post by:
I have created a container that will position 4 panels that has 15 different layouts to choose from. I have based it similar to a System.Windows.Forms.SplitContainer but that has 4 panels...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.