473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3258
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**********@g mail.com>
:11************ ********@8g2000 cwh.googlegroup s.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
10658
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 userControl, I can detect the movement using MouseMove event. the problem is when the mouse is on the child control : I can t detect
15
10949
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
6
3163
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 works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
2
15460
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 events allowing the user control to react to the mouse click. Setting the Enabled property on the label to False comes close, but I don't want the font color to change. Does anyone have an idea how .NET implements the code behind the Enabled...
19
4920
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 exception of custom Collection Classes. Background: I'm developing an A2K .mdb to be deployed as an .mde at my current job-site. It has several custom controls which utilize custom classes to wrap built-in controls, and add additional functionality....
1
2296
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 message but this only goes to the form and I want it in the user control that maybe very much removed from the form's knowledge; i.e. the form may launch a 3rd party form that, upon a call back, decides to launch other form that has my user control...
9
5136
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 UserControl (or Panel, etc). If that particular control is being edited, it IS possible to assign handlers and get events. However, when the control is used on the main form, assigning a handler to the particular control does nothing--the...
2
5585
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. For example:
2
2192
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 instead of 2. It douse not have the ability on fixing the splitter like the SplitContainer class has, each splitter is based on a parentage of the container. For what I wanted it for it did not need that capability so I wasn’t too bothered.
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
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
9923
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...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7475
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
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
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
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.