Hi guys,

I'm trying to find a drag and drop cursor for use in a program. It is not in the standard Windows cursors. It's the one you see when moving a control in Visual Studio or when reordering slides in powerpoint - arrow with rectangle below. Please let me know if you know where I could locate one.

Thanks

GB

Hi,

I think you can find some information, about cursors, here.

He also mentioned that you can create some cursors by yourself with Visual Studio.

Member Avatar for Unhnd_Exception

You can copy it.

Create a scrap windows forms app to copy the cursor.

Add the following code:

This code is by no means special and is for one purpose. Copy the cursor image and then delete the app.

Public Class Form1
    Private WithEvents t As New Timer

    Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
        t.Interval = 1000
        t.Start()
        DoDragDrop(String.Empty, DragDropEffects.All)
    End Sub

    Private Sub t_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles t.Tick
        Dim b As New Bitmap(Cursor.Current.Size.Width, Cursor.Current.Size.Height, Imaging.PixelFormat.Format24bppRgb)
        Dim g As Graphics = Graphics.FromImage(b)
        Static c As Integer = 1
        Cursor.Current.Draw(g, Cursor.Clip)
        b.Save("C:\cursor" & c & ".gif", Imaging.ImageFormat.Gif)
        c += 1

        b.Dispose()
        g.Dispose()
    End Sub

    Private Sub Form1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
        e.Effect = DragDropEffects.All
    End Sub

    Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
        t.Stop()
    End Sub

End Class

After you have the image. Create a new cursor file in the project you want it in.
File/New File/General/Cursor file

Open the image you created from before in MS paint, or something else, and copy and paste it into the new cursor file. You may have to outline the image in black after you paste it. Use the hot spot tool to set the hot spot at the tip of the arrow.

Save it and close it.

If you didn't name it you should see Cursor1.cur in your project.

Click on it.

Set the Build Action to embedded resource.
Set the Copy to Output to Copy if Newer.


When you want to use it:

Me.Cursor = New Cursor(Me.GetType(), "Cursor1.cur")
Member Avatar for Unhnd_Exception

I should say:

Hold the mouse down on button1 and while keeping the mouse held down move the mouse into the form. It should display the cursor your looking for. Keep the mouse held down for a couple of seconds and let it up. After that, You will have the cursor image saved to c:\cursor1.gif or where ever you rename the directory to.

Thanks a lot for the responses guys.

I was unaware of the cursor builder in Visual Studio.

Great app, Unhnd_Exception, thanks.

Hi,

If that solved your problem mark your thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.