473,320 Members | 1,896 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,320 software developers and data experts.

How to get mouseclick from vs designer

How can I determine if a user has clicked on the control in the designer? I would like to change my usercontrol appearance after clicking buttons in that usercontrol.

How can I react on dropping other controls onto my usercontrol? Is there any tutorial for that?

Thank you very much,

mikrogen
Nov 16 '05 #1
1 1282
mikrogen wrote:
How can I determine if a user has clicked on the control in the designer? I would like to change my usercontrol appearance after clicking buttons in that usercontrol.

How can I react on dropping other controls onto my usercontrol? Is there any tutorial for that?


Hi mikrogen,

the best way is to derive your own class from
System.Windows.Forms.Design.ControlDesigner (add a reference to
System.Design.dll)

public class MyControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override void OnPaintAdornments(PaintEventArgs e)
{
//Design time painting here
//Draw a rectangle around the control
}
}

and add this class to your custom control using the
System.ComponentModel.DesignerAttribute

[System.ComponentModel.Designer(typeof(MyNameSpace. MyControlDesigner))]
public class MyControl : Control
{
public override void OnPaint(object sender, PaintEventArgs e)
{
//Normal painting here
}
}

Tutorials are here:

http://www.divil.co.uk/net/articles/...troduction.asp
http://www.howtodothings.com/showart...sp?article=706

Documentation (with examples):
http://msdn.microsoft.com/library/en...classtopic.asp

More info:
http://msdn.microsoft.com/library/en...imeSupport.asp

Cheers

Arne Janning
Nov 16 '05 #2

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

Similar topics

0
by: vince | last post by:
Couldn't find a better place to post the question, feel free to direct me to a better place... Needing to automate our application testing using a keystroke/mouseclick recorder for playing back...
2
by: | last post by:
Hi everybody. Need your help. How can I play sound (.wav-file / camera click) on mouseclick? TIA willy wuff ...
3
by: Kubik | last post by:
Hello! How to detect mouseclick anywhere on the form? There is a lot of controls on the form, so I don't want to add eventhandler for each of them. How can I do it in another way? Adam --...
3
by: Hans | last post by:
Hi! In my windowsformapplication I have a DataGrid where the rowheader is not visible, and readOnly = true. The grid is bound to a DataView where AllowEdit, AllowNew and AllowDelete is set to...
4
by: Peter Rilling | last post by:
What is the difference between the MouseClick and Click events?
4
by: Chris Dunaway | last post by:
I added a MouseClick event to a Button control. It responds properly to the Left click of the button, but not a middle click or right click. Is it possible to get a right click and/or middle...
6
by: Kristian Frost | last post by:
Hi, I'm trying to add, as you might guess, mouseclick listeners to the shapes I am drawing using the GDI+ commands in a similar sort of way as could be done with the old VB "shapes". Problem is,...
2
by: GS | last post by:
how can I tell if it is right mouse click from left mouseclick? I would also to test if a key like control is being held down at the same time. what I would really like to is to capture control...
6
by: RolltheBall | last post by:
Hi there. I am trying to make a certain symbol to appear upon every mouseclick. However, the symbol is a cross and an arrow head. This is how I tried to do it. Private Sub Form1_Paint(ByVal...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.