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

Drag-n-Drop

VR
I am trying to use a custom cursor during drag-drop
operation between 2 ListViews. So, I have a code that at
the time GiveFeedback() is called creates a new cursor
based on the icon and text of the dragged item:

private void listView2_GiveFeedback
(
object sender,
System.Windows.Forms.GiveFeedbackEventArgs e
)
{
string szText = ...;
Bitmap oBitmap = new Bitmap(...);
Cursor oNewCursor = CreateCursor(oBitmap, szText);

e.UseDefaultCursors = false;
this.Cursor = oNewCursor;
}
The problem is that once I stop dragging the item, my
mouse cursor turns back to normal, when it's over listview
controls, but over the form it still looks like the custom
cursor I created.

I suspect that somewhere I have to set UseDefaultCursors
back to true, as well as I should set the cursor itself
back to Cursors.Arrow.

The question is where should I do it? Which other event
has the same parameters so I would have access to
UseDefaultCursors?

Thanks,
VR
Nov 15 '05 #1
1 6271

Hi VR,

If you want to set the cursor back to default when it is not on the
LIstView control, you can
determine if the e.Effect is DragDropEffects.Move.

Something like this:

private void Form1_GiveFeedback(object sender,
System.Windows.Forms.GiveFeedbackEventArgs e)
{
e.UseDefaultCursors =false;
try
{
if((e.Effect & DragDropEffects.Move )==DragDropEffects.Move )
{
Cursor.Current=new Cursor("3dgarro.cur");
}
else
{
Cursor.Current =Cursors.Default ;
}
}
catch(Exception ex)
{
MessageBox.Show (ex.Message );
}
}

HTH.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "VR" <Vi****************@gat.com>
| Sender: "VR" <Vi****************@gat.com>
| Subject: Drag-n-Drop
| Date: Tue, 26 Aug 2003 18:35:22 -0700
| Lines: 35
| Message-ID: <07****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcNsO3tqDy5++BOHTIqwg3wyleQWzA==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179698
| NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I am trying to use a custom cursor during drag-drop
| operation between 2 ListViews. So, I have a code that at
| the time GiveFeedback() is called creates a new cursor
| based on the icon and text of the dragged item:
|
| private void listView2_GiveFeedback
| (
| object sender,
| System.Windows.Forms.GiveFeedbackEventArgs e
| )
| {
| string szText = ...;
| Bitmap oBitmap = new Bitmap(...);
| Cursor oNewCursor = CreateCursor(oBitmap, szText);
|
| e.UseDefaultCursors = false;
| this.Cursor = oNewCursor;
| }
|
|
| The problem is that once I stop dragging the item, my
| mouse cursor turns back to normal, when it's over listview
| controls, but over the form it still looks like the custom
| cursor I created.
|
| I suspect that somewhere I have to set UseDefaultCursors
| back to true, as well as I should set the cursor itself
| back to Cursors.Arrow.
|
| The question is where should I do it? Which other event
| has the same parameters so I would have access to
| UseDefaultCursors?
|
| Thanks,
| VR
|

Nov 15 '05 #2

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

Similar topics

0
by: Meikel | last post by:
Once I had drag and drop working in my Jtrees just implementing the AutoScroll-interface (with the methods from the example) worked for me. No extra registering was required. For drag and drop...
1
by: zbcong | last post by:
hello there are two ListViews with the SAME coloumns within one winform,i want to move the data from one ListView into other one,what is the simplest method? thank you!!
0
by: Anjali | last post by:
Hi, I want to implement DragnDrop across th forms of the application. I am able to get some examples to implement DragnDrop across the controls in the same form but I have to implement that...
6
by: John E. Fox | last post by:
Dear All, I am running Access 97 and I suspect that drag and drop is not supported ( or at least I can't do it! ) Is this supported in any of the later Access versions? I don't particluarly...
2
by: Michael Maercker | last post by:
hi! i come from vb6 and am wondering: what happened to ole_drag/drop? and how can implement dragndrop from the explorer (or any other file list, i.e. winamp) into my listbox in c#? i've done...
1
by: thomasp | last post by:
Has anyone got some sample code to do drag and drop from one listbox to another listbox using VB.Net 2005. The below code works for draging and droping one at a time, but not for multiselected...
3
by: thomasp | last post by:
Has anyone got some sample code to do drag and drop from one listbox to another listbox using VB.Net 2005. The below code works for draging and droping one at a time, but not for multiselected...
2
by: Sam | last post by:
Hi, In my form I have two ToolStripPanels (TSP), one docked on the left, the other docked on the right. Each of those TSP contains a ToolSrip control. I would like to allow the ToolStrips to...
4
by: Full NameEntry | last post by:
Hi all, I'm new to csharp... learning it by muddling my way though examples. In my current example, I'm trying to make a form with a bunch of listboxes that have drag and drop enabled amongst...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.