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

TreeView Mouse event behaviour puzzles

Hello everyone,

I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client
application using SQL Server on the server side.

I am looking to implement drag & drop in a TreeView control. The operation
takes place entirely within this single control. There is no need to provide
for interaction with other controls, forms, applications etc. Both the drag
source item (a TreeNode) and the drag target item (another TreeNode) are
within the same TreeView.

I have tried using the ItemDrag/DoDragDrop/DragDrop approach but it isn't
cooperating. The DragDrop event just does not fire. NB: TreeView.AllowDrop =
true. Anyway, I thought I would use the old approach of
MouseDown/MouseMove/MouseUp but that isn't working either.

Even though this question is framed in the context of an attempt to
implement drag & drop, this is not really a question about that process. When
I changed to the MouseDown/MouseMove/MouseUp approach the MouseDown/MouseUp
pair started exhibiting some very strange behaviour.

The MouseDown Event is followed immediately by a MouseUp event even
though the mouse button has not been released.

This code:
///__________________________________________________ ______
private void TvwManager_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
System.Console.WriteLine("Manager_MouseDown");
}
///__________________________________________________ ________________
private void TvwManager_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
System.Console.WriteLine("Manager_MouseUp" );
}
///__________________________________________________ ________________
private void TvwManager_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
System.Console.WriteLine("Manager_MouseMove" );
}

Produces this result:

Manager_MouseMove
....
Manager_MouseMove
Manager_MouseDown
Manager_MouseUp
Manager_MouseMove
....
Manager_MouseMove
Manager_MouseDown
Manager_MouseUp
....

Explained as follows
**cursor enters the control, start receiving MouseMove events
Manager_MouseMove
....Numerous MouseMove events occur in succession here
Manager_MouseMove
**Left Mouse button pressed and held down
Manager_MouseDown <<MouseDown occurs -- just as it should
Manager_MouseUp <<MouseUp follows immediately even though the mouse button
has not been released
Manager_MouseMove <<This sequence of MouseMoves occurs while the button is
down
....
**Left button is released but, of course, the MouseMove events keep coming
Manager_MouseMove

Manager_MouseDown <<Try it again...Sequence described above repeats: MouseDown
Manager_MouseUp <<followed immediately by MouseUp
etc...

What is going on here? Has anyone else observed this behaviour?
What's to be done about it?

--
Kia pai tō haere, e hoa mā!
Nā Plumer
Nov 22 '05 #1
0 946

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

Similar topics

0
by: Plumer | last post by:
Hello everyone, I am using MS .NET Framework 1.0 Version 1.0.3705 developing a C# client application using SQL Server on the server side. I am looking to implement drag & drop in a TreeView...
1
by: Jacek Jurkowski | last post by:
TreeView Control: If I click using left mouse button on a TreeNode it gets blue and SelectedNodeproperty is Changing - Ok. But if I click on it using right mouse button node is getting blue but...
3
by: vijaynats | last post by:
I have a treeview with a ContextMenu attached. When i click on a node, AfterSelect fires but does not fire when right clicked (the context menu pops up). (Background: I have loaded a list of...
5
by: rh | last post by:
I created a user control that is made up of a TreeView and a VScrollBar. I set the TreeView.FullRowSelect = True and it works as expected (full row is visible, appears on top of everything else)...
17
by: Spam Trap | last post by:
I am upgrading from VB6 where I had access to a treeview NodeClick event (see below)... but now VB.NET does not have this any more. Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)...
5
by: A-PK | last post by:
Hi, I am using treeview as my menu. my menu is like the following + Users & Groups - Users -Groups + Departmenuts - Engineering
3
by: sianan | last post by:
Hi, I want to display a 'hover box' (for want of a better description) when the mouse hovers over a node in a tree view. The box would display detail information for the node. It should be...
1
by: pooja | last post by:
i need to implement drag and drop in treeview in VB. Kindly help. My treeview contains activities maintained using XML Files. Hopefully, Thanks.
1
by: timnels | last post by:
I have created a muti-select treeview control. Problem is I am now trying to implement drag/drop in the application that uses it. It seems the mouse down and mouse move events fire before the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.