Image On Mouse Over.

How do I get an imgae to display & follow the mouse by having my mouse over another image



Answer this question

Image On Mouse Over.

  • Melt16

    Ok, heres the deal:

    I need to get an image to display (like a tooltip) when I put my cursor over another image.

    Thats about it. If you can help me with this that would be nice :)


  • Daikoku

    2 things:

    1. I posted a 2nd topic because I don't even know if the 1st got posted. I had no microsoft alert things come up so I just assumed it didn't post.

    and 2. Thank you SOOOOO much! I really needed this code. you see I'm programming a form based game and I just learned how to do cinematics so I needed my 3rd important aspect of the game.

    Thanks!

    ~Chris a.k.a. Dellmonty


  • Syed Rahman Mashwani

    Bruno,

    Sounds to me like the OP wants the mouse pointer to change to an image on the event of mouse_hover over another image.

    The OP may want to leave a pointer trail too

    What is the maximum size for a mouse pointer image, by the way, please

     

    Regards,

    S_DS

     



  • WN3335

    HI

    your code really helped me in my drag drop code the images from thumb view to Viewer code

    -GRK



  • Biju Varughese

    I forgot that the image must follow the mousepointer, so this updated code for the Form1 class will do that:

    (Note: add the unchanged code for the xxToolTip class too, of course)

  • Anton__

    Dellmonty,

    Your problem confused me. I have to understand your problem in two steps:

    1. Display an image, however, where would you like to display On a form or some other controls It is known that there are so many controls that can display images.

    2. What is the meaning of "Follow the mouse by having my mouse over another image" Could you give me an explanation

    Thank you for your question and I hope you can make it specificly in your reply.



  • Reid Williams

    You can also set up a custom cursor that only

    displays when over a particular control:

    ' Cursor from image example.

    ' Example uses a button, picturebox

    ' and openfiledialog

    Public Class Form1

    Dim pubcur As Cursor

    Private Sub Button1_Click(ByVal sender As System.Object, _

    ByVal e As System.EventArgs) Handles Button1.Click

    OpenFileDialog1.Filter = "Jpg files (*.jpg)|*.jpg|Bmp files (*.bmp)|*.bmp"

    If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

    ' If you do not size the cursor's source

    ' bitmap as shown below (32x32). The cursor can/will be

    ' quite large. Transparent and translucent areas of the

    ' source bitmap will work here.

    Dim theBitmap2 As New Bitmap _

    ((Image.FromFile(OpenFileDialog1.FileName)), 32, 32)

    pubcur = New Cursor(theBitmap2.GetHicon)

    End If

    End Sub

    Private Sub PictureBox1_MouseLeave(ByVal sender As Object, _

    ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave

    Me.Cursor = Cursors.Arrow

    End Sub

    Private Sub PictureBox1_MouseMove(ByVal sender As Object, _

    ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove

    If pubcur IsNot Nothing Then

    Me.Cursor = pubcur

    End If

    End Sub

    End Class



  • Bernaridho

    You've actually given the answer yourself: make a customized tooltip, one that shows an image.

    Here's a working example - just create a new project/windowsapplication, then add a label (named Label1) to Form1, and copy/paste the code below as the code for Form1:

  • Polina159216

    Please do not post the same question multiple times - it may take time for someone with a suggestion to post. Multiple posts also are less likely to be answered (since it simply becomes noise in the forum).

    Thanks.



  • andriscs

    Take a look at my reply in this topic:
    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1195041&SiteID=1&mode=1

    A tooltip can easily be made to always show, so that would give you the behaviour you're requesting.

  • Image On Mouse Over.