473,398 Members | 2,088 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,398 software developers and data experts.

MouseButtons

Petzolds C# book has code like this:

(mea.Button & MouseButtons.Right != 0)

I try the C++/CLI analog:

if( (e->Button & ::MouseButtons::Left) != 0 )

but get errors:

error C2678: binary '!=' : no operator found which takes a left-hand
operand of type 'System::Windows::Forms::MouseButtons' (or there is no
acceptable conversion)

why?

Sep 19 '07 #1
1 1859
Hi dragonslayer008,
Petzolds C# book has code like this:

(mea.Button & MouseButtons.Right != 0)

I try the C++/CLI analog:

if( (e->Button & ::MouseButtons::Left) != 0 )

but get errors:

error C2678: binary '!=' : no operator found which takes a left-hand
operand of type 'System::Windows::Forms::MouseButtons' (or there is no
acceptable conversion)
Use if((e->Button & ::MouseButtons::Left) == ::MouseButtons::Left) which
uses the same type on both sides of the operator. Otherwise you would need
to cast either of the two sides explicitly.

--
SvenC

Sep 19 '07 #2

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

Similar topics

8
by: NeoAsimov | last post by:
Hello, There is what I want to do. I worked on the problem since 6 hours but I had a problem (probably stupid) and I dont know how to resolve it. I need to have an Mouse Event Click when...
5
by: kerpal | last post by:
hi all, I'm trying to draw lines from an origin to the coordinate of the mouse. As the mouse moves, the line will follow the mouse's movement and previous lines are then erased. any...
1
by: Joerg Trumpfheller | last post by:
Hey people, how can I select a treenode with the MouseButtons.Right event if there is no contextmenu? I build up a treeview with 3 levels. Only if the second level is selected, there should...
1
by: tlemcenvisit | last post by:
Hello, Please, what is the equivalent code of if(e.Button == MouseButtons.Left) in VC++.NET Thanks in advance
2
by: Terry | last post by:
Hi, I copied the following code segment from the VS2005 Help on the MouseDown event. Private Sub panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
1
by: iamahulk | last post by:
Why do I get a warning: Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated When accessing a shared method in...
8
by: Chaitanya | last post by:
Hello, In my Application i want to know when user clicks both the "Left" and "Right" buttons of the Mouse. I am getting a number like this "3145728". But the MouseButtons Enum contains only Left,...
1
by: RobAMacAF | last post by:
I have code that when you drag a child form within 5 of the parent one it docks. Then when you drag it out of the 5 it returns the size of the child form to what it started as....That works GREAT!...
0
by: dragonslayer008 | last post by:
I have code in a OnMouseMove(MouseEventArgs^ e) handler: if( (e->Button == ::MouseButtons::Left) ) { It does not work if I don't put the :: before MouseButtons, i.e., if( (e->Button ==...
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
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...
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
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...
0
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,...

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.