Drag Bitmap tutorial/code anywhere?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robinson

    #1

    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


  • Peter Proost

    #2
    Re: Drag Bitmap tutorial/code anywhere?

    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" <toomuchspamhas passed@myinboxt oomuchtoooften. comschreef in
    bericht news:eg2p9i$ho2 $1$8302bc10@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
    >
    >

    Comment

    • Robinson

      #3
      Re: Drag Bitmap tutorial/code anywhere?


      "Peter Proost" <pproost@nospam .hotmail.comwro te in message
      news:OAQdzvI6GH A.756@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


      Comment

      Working...