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

How do I mark a mouse click as handled?

Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.

Aug 24 '06 #1
4 7861
Hi,

IIRC there is no equivalent. The way of doing it is by deriving the control
you want, overwrite onMouseDown and not calling the base method
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

<ko**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.

Aug 24 '06 #2

ko**********@gmail.com wrote:
Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.
try this

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == 0x202) /* WM_LBUTTONUP */
{
// Handle the mouse Event here

m.Result = new IntPtr(1); // Sucessful
return; //eat up the message
}
base.WndProc(ref m);
}

override the WndProc function of the control whose click you want to
supress (by overriding that control)

Alternatively capture the WM_NOTIFY message and check if its left
button click and if its on the control that you want to handle.

But is a little bit complex and I dont remember right now how exactly
to do this.
code goes something like this.
if(m.Msg == WM_NOTIFY)
{
NMHEADER = get this thing from m.LParam

then the NMHEADER structure has all the information required to know
what type of notification message is it and which control is it meant
for.
}

for a list on the constant values for the Windows Messages refer this
link
http://www.autohotkey.com/docs/misc/SendMessageList.htm

Searching on google might help.

Sorry for the incomplete solution.

Aug 24 '06 #3
Hi,
"DaanishRumani" <da************@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>
ko**********@gmail.com wrote:
>Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.
You have to derive the control anyway, if you do so is better to just
override the onMouseDown method.


Aug 24 '06 #4
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,
"DaanishRumani" <da************@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>ko**********@gmail.com wrote:
>>Hello,

Does anyone know of how I can go about suppressing a mouse click after
I've handled it? I know this can be done for keystrokes via the
Handled property, but I am unable to find a way to do so for mouse
events.

You have to derive the control anyway, if you do so is better to just
override the onMouseDown method.

Unless the processing is done outside of the control, e.g. when the
source code for it is not available. Then you have to go the WndProc way
(I think).
Sep 6 '06 #5

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

Similar topics

9
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
2
by: Dennis | last post by:
My control takes a certain action when one area is clicked. However, I want to override this action in the MouseUp or Click Event much like the KeyPress Event where you can set the KeyEventArg to...
2
by: John Dann | last post by:
This question has arisen from an earlier thread but is really a separate issue: I have a VB.Net listbox control on a form. I want to be able to do 2 things with items displayed within the one...
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...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
1
by: archana | last post by:
Hi all, I am having one confusion regarding changing cursor to wait cursor I am providing auto refreshing facility for listview using timer. So what i am doing is when auto refreshing is in...
7
by: Steve | last post by:
How do you disable the mouse right click to prevent pop-up window? Or if I want to have cut/copy/paste on pop-up window use same code as my custom cut/copy/paste that are triggered by toolstrip...
5
by: moonie | last post by:
I have an msn style c# windows application with a form and panel on it. A news list is drawn from the database and dynamically added via labels, link lables during form loading. In this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.