473,666 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drag Bitmap tutorial/code anywhere?

Hi,

Can anyone point me towards a good drag/drop tutorial that allows me to
create/render my own drag-cursor (i.e. for instance, if I wish to drag a
list item, I can render the list item at the cursor location as the user
drags it around the screen). Has anyone successfully done this in VB.NET?
How does it perform? Any pitfalls?

Thanks,

Robin
Oct 5 '06 #1
2 3202
Hi this sample shows how to create a cutsom cursor, haven't tested it with
dragging and dropping.

Dim myCur As Cursor()
Dim g As Graphics
Dim cur As Cursor

g = TextBox1.Create Graphics
Dim myBmp As New Bitmap(CInt(g.M easureString(Te xtBox1.Text,
TextBox1.Font). Width), 20)
g = Graphics.FromIm age(myBmp)
g.Clear(Color.R ed)
g.DrawString(Te xtBox1.Text, TextBox1.Font, Brushes.White, 2, 2)
g.Dispose()
Dim ptrCur As IntPtr = myBmp.GetHicon
cur = New Cursor(ptrCur)
Cursor.Current = cur

hope this helps,

Greetz, Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Robinson" <to************ ******@myinboxt oomuchtoooften. comschreef in
bericht news:eg******** ***********@new s.demon.co.uk.. .
Hi,

Can anyone point me towards a good drag/drop tutorial that allows me to
create/render my own drag-cursor (i.e. for instance, if I wish to drag a
list item, I can render the list item at the cursor location as the user
drags it around the screen). Has anyone successfully done this in VB.NET?
How does it perform? Any pitfalls?

Thanks,

Robin


Oct 5 '06 #2

"Peter Proost" <pp*****@nospam .hotmail.comwro te in message
news:OA******** *****@TK2MSFTNG P05.phx.gbl...
Hi this sample shows how to create a cutsom cursor, haven't tested it with
dragging and dropping.

Dim myCur As Cursor()
Dim g As Graphics
Dim cur As Cursor

g = TextBox1.Create Graphics
Dim myBmp As New Bitmap(CInt(g.M easureString(Te xtBox1.Text,
TextBox1.Font). Width), 20)
g = Graphics.FromIm age(myBmp)
g.Clear(Color.R ed)
g.DrawString(Te xtBox1.Text, TextBox1.Font, Brushes.White, 2, 2)
g.Dispose()
Dim ptrCur As IntPtr = myBmp.GetHicon
cur = New Cursor(ptrCur)
Cursor.Current = cur

hope this helps,

Greetz, Peter
--
Thanks for that Peter. I also found some samples like this one:
http://www.planet-source-code.com/vb...3855&lngWId=10.
I'm going to give it a try this afternoon.

Robin
Oct 6 '06 #3

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

Similar topics

0
1080
by: Frank Rizzo | last post by:
I have an app where users can drag and drop a file onto the app. I catch the event and do processing based on the dropped file. Sometimes the processing takes long time. For some reason, the window from which I dragged the file is dead until the processing is done. How can I release the window? Here is the code by which I grab the file. private void tv_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
5
4955
by: Clyde | last post by:
I am trying to implement the user feedback provided by Windows Explorer when draggng a filename from one place to another. I have the drag and drop action worked out but have had no luck in finding how to capture the piece of the screen into a bitmap to simulate the movement. I know this could be done with the Windows API but can't find any way to do it with .Net functions. Any help is appreciated.
1
1629
by: | last post by:
I put two picture boxes on my main form. I was not able to drag and drop on any of them. Also, the AllowDrop property is not available at design time for the picture box. Any advice on an easy way to implement drag and drop for picture boxes? Thanks Edi.
2
9195
by: Grey | last post by:
I need to design a workflow application with C#. I want to design an UI with some workflow components which they can be drag & drop anywhere in order to design the workflow for the application users. Moreover, when the user double click on the component, they can define some routing rules for the process. Is it possible to have such fancy UI in C#?? Any reference sites or tutorial?? Million Thanks.
6
6483
by: Alfonso2968 | last post by:
Hello, If someone can help plz. I have searched everything and all I can find is how to drag and drop within a form from panel to panel. What I need to do is Drag an image from the desktop or from an open folder to a panel on my form. This will be done for a few images and then on Buttonclik I need to save each image in its own folder.
0
1715
by: Truevision .Net | last post by:
Hi, I have a problem with drag and drop functionality when it comes to dropping pictures from sources like for example internet explorer and the webbrowser control. Dragging and dropping from picturebox to picturebox works just fine. This part of the program is basically that it navigates to a page in a webbrowser control and on this page there are several pictures to chose from. I want to drag and drop one of them to a picturebox and
1
5937
by: sCryptKeeper | last post by:
I'm trying to change the cursor while a drag and drop occurs between two lists in a winforms. I tried several ways (several tutorial and solutions) found over the web. I even tried to simply change the cursor when the form loads. But as soon as the mouse moves, the cursor is back to default. I use the following events for my drag and drop. this.MatchRequisitionListView.MouseUp += new...
1
1860
by: Eric von Horst | last post by:
Hi, I need some advice on Drag&Drop. What I want to achieve is the following: - I have a window that is divided in two : on the left hand I have a wx.TreeCtlr and on the other hand a wx.StaticBitmap I want to be able to drag an item from the tree onto the static bitmap.
1
1244
by: ashwinigopi | last post by:
Hi I am trying to drag and drop image to a picture box in the form. I using this code but doesnt seem to work. Here is the code, private void Form1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.Bitmap)) { e.Effect = DragDropEffects.Copy; } else {
0
8444
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
8356
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
8869
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...
1
8551
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7386
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
6198
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
5664
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();...
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
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.