By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,305 Members | 1,903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,305 IT Pros & Developers. It's quick & easy.

Custom Control Mouse Events

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.