473,800 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drag Drop Woes

bob
Hi,
VS2008
Trying to implement a simplified version of Mike Gold's tutorial on
Drag Drop.
My problem is that the dragover event handler never appears to pass
over a node.
I move the 'envelope' all over the tree view but FindTreeNode always
returns null.
The event handler e member appears to contain legiitimate X,Y
co-ordinates but myTreeView.GetN odeAt(X,Y) always returns null;
Any clues as to what I am doing wrong?
thanks
Bob
Code follows:
private void tvInstallation_ DragOver(object sender, DragEventArgs e)
{
//Point p = new Point(e.X,e.Y);
TreeNode aNode = FindTreeNode(e. X, e.Y);
if(aNode!=null)
{
aNode.BackColor = Color.DarkBlue;//NEVER GET HERE
}
}

private TreeNode FindTreeNode(in t X,int Y)
{

return tvInstallation. GetNodeAt(X,Y); //Getting Called but
always returning null

}
Jun 27 '08 #1
2 1506
On Tue, 22 Apr 2008 22:40:10 -0700, bob
<st************ **@cutthis.adri ley.co.nzwrote:
[...]
The event handler e member appears to contain legiitimate X,Y
co-ordinates but myTreeView.GetN odeAt(X,Y) always returns null;
Any clues as to what I am doing wrong?
Why do the coordinates appear legitimate to you?

According to MSDN (always a good place to look when things aren't working
as you expect), the X and Y properties of DragEventArgs are given in
screen coordinates. You need to convert them to client coordinates, using
the PointToClient() method of your control, before passing them to
GetNodeAt().

Pete
Jun 27 '08 #2
bob
On Tue, 22 Apr 2008 22:56:58 -0700, "Peter Duniho"
<Np*********@nn owslpianmk.comw rote:
>On Tue, 22 Apr 2008 22:40:10 -0700, bob
<st*********** ***@cutthis.adr iley.co.nzwrote :
>[...]
The event handler e member appears to contain legiitimate X,Y
co-ordinates but myTreeView.GetN odeAt(X,Y) always returns null;
Any clues as to what I am doing wrong?

Why do the coordinates appear legitimate to you?

According to MSDN (always a good place to look when things aren't working
as you expect), the X and Y properties of DragEventArgs are given in
screen coordinates. You need to convert them to client coordinates, using
the PointToClient() method of your control, before passing them to
GetNodeAt().

Pete
Right on the money Pete.
Thanks.
Bob.
Jun 27 '08 #3

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

Similar topics

6
6288
by: hemant_mishal | last post by:
Hi All, I am writting a java script library which will provide inter frame drag and drop operation. The more precise will be OLE drag and drop, which means only data will be transfered from frame to frame not any object. But it should happen in a drag and drop fashion. The requirement is, user will click on one object and will drag the mouse to another frame and will drop on some object the data will be passed by this and some action will...
0
2607
by: Lauren Quantrell | last post by:
I'm trying to drop a file from Windows Explorer (or desktop, etc.) onto a field in Access2K and capture the full file path. I found an posting below that says this is possible but I cannot simutate it. Can anyone help? Thanks ************************** previous post: Message 1 in thread
2
4337
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10421
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
6
3562
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product where the user can run on firefox/mozilla, what would be a good approach. 1. Should I overwrite the javascript code drag-and-drop to make it more browser independent. If I want to go this route, can anybody provide me a
3
10600
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
4716
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When I drop onto the shell I want a file created with a specified name containing the data from the database. I've looked at the FileDrop format but it look to have only the filename and not the data. TIA
0
2499
by: RHSFSS | last post by:
Hi, I have a Drag and Drop registration problem (See http://www.thescripts.com/forum/thread434707.html for similar problem post), can anyone out thereadvise on the best solution? I have a .NET 2.0 application (actually in C#) called from a third party piece of software via VBScript. The VB script passes an object as a parameter which my application applies changes to. My C# application dynamically creates a form, which includes controls...
5
13814
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with drag&drop on the same page (which was not possible). Now i´ve a new concept of the script, more object oriented. I´ve also commented the whole code so you guys can easier understand it engine. What exactly we need when trying to make a column drag &...
0
9690
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
9551
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
10504
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
10274
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 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...
0
10033
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 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...
0
6811
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.