473,772 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MouseButtons

Petzolds C# book has code like this:

(mea.Button & MouseButtons.Ri ght != 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::Window s::Forms::Mouse Buttons' (or there is no
acceptable conversion)

why?

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

(mea.Button & MouseButtons.Ri ght != 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::Window s::Forms::Mouse Buttons' (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
12689
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 I click on the frame of a window form ( like the title bar of a window).
5
1180
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 suggestions on how to achieve this efficiently? Thanks in advance.
1
1754
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 be a contextmenu. This works without problems. In between this level I can select the next node with the mouseButtons.Right because there is a contextmenu. If I try to select a node of the first or third level , it gets selected by
1
1562
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
1122
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 panel1.MouseDown ..... Select Case e.Button Case MouseButtons.Left <-Warning eventString = "L" Case MouseButtons.Right <-Warning
1
1313
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 the framework. (for example) If Control.MouseButtons = MouseButtons.None Then.... What is the point of includes if they don't prevent this type of warning? Will I always need to explicitly specify the name space? If Control.MouseButtons =...
8
4634
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, Right, Middle, None, XButton1 and XButton2. I am using .NET 1.1 version. How can i convert "3145728" to MouseButtons Enum? why Mouse Left+Right click not added to the Enum? Can anyone help me?
1
1254
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! But when you release the mouse the child form then goes back to the size it was when it was docked. You drag it again and it goes back to the creation size like I wanted until I release the mouse again! GGGAAAH! I found a way to make it resize...
0
1886
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 == MouseButtons::Left) ) results in:
0
9621
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
9454
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
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8937
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
7461
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
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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

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.