468,253 Members | 1,249 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,253 developers. It's quick & easy.

Disbaling RightMouse Button Click

Hi

In Windows Application (C#), on RightMouse Button click in a Textbox, a
Popup menu with Cut / Copy / Paste is appearing. How to disable this
behaviour. I dont want to allow the user to copy and paste using the
rightmouse button.

How to do that?

waiting for your reply

Regards
Karuppasamy Natarajan
Jul 21 '05 #1
1 1405
First off - please do NOT crosspost to a whole slew of newsgroups!
Post it to one, maybe two RELEVANT newsgroups ONLY. Thanks.
In Windows Application (C#), on RightMouse Button click in a Textbox, a
Popup menu with Cut / Copy / Paste is appearing. How to disable this
behaviour. I dont want to allow the user to copy and paste using the
rightmouse button.


You could always override the MouseDown event for that TextBox, and
just "swallow" the mouse event (not do anything with it) - that should
disable the system-default behaviour.

Select your textbox on the design surface, and select the "Events"
page in your property inspector. Find the "MouseDown" event,
double-click to create a stub event handler, and then write something
like:

private void textBox1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
// do nothing
}
}

Marc

================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by yfng | last post: by
11 posts views Thread by CW | last post: by
3 posts views Thread by Imran Aziz | last post: by
1 post views Thread by Karuppasamy | last post: by
7 posts views Thread by =?Utf-8?B?bWFydGluMQ==?= | last post: by
9 posts views Thread by Jonathan Wood | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.