Hi,
I have a treeview and user can right click the treenodes,
depending on the nodes, different shortcut menu will
appear.
I want only the shortcut menu to appear if the point of
the right mouse click is within the label text of the
treenode instead of row-wide.
I solved this problem already but when I right click the
treenode, there is a quick highlight on the treenode
regardless of wether the point of click is within the text
label or not. Does anyone know how to get rid of the quick
highlight? It's quite annoying [It hightlights for a
second and gone] when the point of right mouse click is
outside of the text label.
Thank you.
regards,
Sean 2 6274
I do not see this behavior with this method:
private void treeView1_Mouse Up(object sender,
System.Windows. Forms.MouseEven tArgs e)
{
if ( e.Button != MouseButtons.Ri ght )
return;
System.Windows. Forms.TreeNode node = this.treeView1. GetNodeAt( e.X, e.Y );
if ( node == null )
this.cxMenuTree Help.Show(this. treeView1, new Point(e.X, e.Y));
else if ( node.Bounds.Con tains(e.X, e.Y) )
this.cxMenuZone .Show(this.tree View1, new Point(e.X, e.Y));
else
this.cxMenuTree Help.Show(this. treeView1, new Point(e.X, e.Y));
}
Do you still see it using this?
--
William Stacey, MVP
"Sean" <an*******@disc ussions.microso ft.com> wrote in message
news:1c******** *************** ******@phx.gbl. .. Hi,
I have a treeview and user can right click the treenodes, depending on the nodes, different shortcut menu will appear.
I want only the shortcut menu to appear if the point of the right mouse click is within the label text of the treenode instead of row-wide.
I solved this problem already but when I right click the treenode, there is a quick highlight on the treenode regardless of wether the point of click is within the text label or not. Does anyone know how to get rid of the quick highlight? It's quite annoying [It hightlights for a second and gone] when the point of right mouse click is outside of the text label.
Thank you.
regards, Sean
Hi William,
Thank you for your reply.
I just tried your code but the problem still persists.
Actually, what I need is exactly like your code but on the
else part, I don't want the node to get selected:
if ( node == null )
this.cxMenuTree Help.Show(this. treeView1, new Point
(e.X, e.Y));
else if ( node.Bounds.Con tains(e.X, e.Y) )
this.cxMenuZone .Show(this.tree View1, new Point(e.X,
e.Y));
else
//on this part: I don't want the node to get selected
this.cxMenuTree Help.Show(this. treeView1, new Point
(e.X, e.Y));
On the last else above, I don't want the node to get
selected.
Actually in the method treeview1_mouse down, I check to see
if the mouse click point is within bounds.
If it is, make that node to be the selectednode, else make
selectednode = null (meaning no blue highlight).
This works perfectly on left mouse click. However, the
right mouse click causes a quick blue highlight on the
treenode even though the point is out of the bounds.
I am now trying to eliminate the quick highlight on right
mouse click.
Please let me know if you have any other suggestion.
regards,
Sean -----Original Message----- I do not see this behavior with this method:
private void treeView1_Mouse Up(object sender, System.Windows .Forms.MouseEve ntArgs e) { if ( e.Button != MouseButtons.Ri ght ) return;
System.Windows. Forms.TreeNode node =
this.treeView1. GetNodeAt( e.X, e.Y ); if ( node == null ) this.cxMenuTree Help.Show(this. treeView1, new Point(e.X,
e.Y)); else if ( node.Bounds.Con tains(e.X, e.Y) ) this.cxMenuZone .Show(this.tree View1, new Point(e.X,
e.Y)); else this.cxMenuTree Help.Show(this. treeView1, new Point(e.X,
e.Y));}
Do you still see it using this? -- William Stacey, MVP
"Sean" <an*******@disc ussions.microso ft.com> wrote in
messagenews:1c******* *************** *******@phx.gbl ... Hi,
I have a treeview and user can right click the
treenodes, depending on the nodes, different shortcut menu will appear.
I want only the shortcut menu to appear if the point of the right mouse click is within the label text of the treenode instead of row-wide.
I solved this problem already but when I right click the treenode, there is a quick highlight on the treenode regardless of wether the point of click is within the
text label or not. Does anyone know how to get rid of the
quick highlight? It's quite annoying [It hightlights for a second and gone] when the point of right mouse click is outside of the text label.
Thank you.
regards, Sean
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: worzel |
last post by:
Can't suss this out for the life of me, googling of no help either.
Okay, new to win forms; I have a treeview with several root nodes, each
having a single level of child nodes underneath. I also havea context
(popup) menu which, what I want, is for it to pop up with certain options
(menuItems) when a root treeNode is selected and different options when a
child node is selected. It is all working well except for one problem - if I
right...
|
by: Steve |
last post by:
C#
Is it possible to get a popup menu to fire on right click of a node in a
treeview?
Thanks
|
by: paradox |
last post by:
How can I go about having a TreeNode selected when I right click? I
tried using the Click event, but the event does not pass in the node
that was clicked.
Currently you have to left click a node in order to select it. I want
to be able to write click and bring up a context menu with only certain
options available depending on the node selected. I got the context
menu to come up (which is very easy to do), however, you first have to
left...
|
by: Juan Romero |
last post by:
Hey guys,
I am trying to detect a node right click event, but I can't seem to find a
way do this.
The only way I found to get to a point where I know the user clicked the
node is by checking the afterselect event of the treeview control. The Event
arguments variable has an action property which tells me whether the user
clicked the node, or expand it or whatever.
|
by: Juan Romero |
last post by:
Hey guys, I have a small problem here....
I have a treeview control. I want to display a popup menu when the user
right clicks on a node. This is no problem, and I am able to make the popup
come out.
However, when I want to perform an operation based on the node selected, I
find that the node actually gets selected after the popup goes away. In
other words, if I right click a random item in the treeview and the user
selects an...
| |
by: tmaster |
last post by:
I can detect a right click on my treeview, but SelectedNode.Index points to
the last node that was left-clicked. Is there a way for a right-click event
of a treeview to update the SelectedNode.Index?
Private Sub tvwTopics_Mouseup(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles tvwTopics.MouseUp
If e.Button = MouseButtons.Right Then
MsgBox("Right click " &...
|
by: Patrick |
last post by:
This may be a simple question but how can I make the tree change the
selected node... on a right click .. in addition to the left click?
What I want is to filter my context menu based on the type of node selected
but the left click doesn't seem to change the selected node.
Thanks,
|
by: sugee |
last post by:
hi,
I have a treeview when rightclicked a context menu should appear. but first time wen i right click the context menu of that node(ie, add,delete) appears whereas when i right click another node the context menu of the previously selected node appears.ie, context menu with add, delete appears instead of add,delete and edit.can anyone help in this issue. Here is my code.
if(e.Button==MouseButtons.Right)
{
treeView1.SelectedNode =...
|
by: avanti |
last post by:
Hi,
I am trying to show a context menu on a right click in some of my
controls. I want to show it at the right location. However it is
getting shown away from the mouse click location. Here is the code:
private void QueryTreeView_Clicked(object sender, EventArgs
args)
{
|
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...
|
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,...
| |
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |