Vb Question...

Discussion in 'Programming General' started by Visual Basic Matt, Sep 1, 2008.

Vb Question...
  1. Unread #1 - Sep 1, 2008 at 4:34 PM
  2. Visual Basic Matt
    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056

    Visual Basic Matt Apprentice

    Vb Question...

    I'm trying to make it so that when you hover over an image another image will move to your mouse position, so that its like an icon. (I don't want it to just make the image the icon as load it from the properties message.) I want to use the image I have captions and text boxes on. So, when you hover over an object it will show the thing to edit it and it will move along with your mouse. Sorry if i didn't explain that very well, I tryied to make it as easy to understand as possible... =|
     
  3. Unread #2 - Sep 1, 2008 at 5:03 PM
  4. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Vb Question...

    Do you want to replace the cursor, or place an image under it?
     
  5. Unread #3 - Sep 1, 2008 at 6:05 PM
  6. Visual Basic Matt
    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056

    Visual Basic Matt Apprentice

    Vb Question...

    Just place an image under it like a tooltip text but a diferent way to display it..
     
  7. Unread #4 - Sep 2, 2008 at 1:46 AM
  8. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Vb Question...

    i know what you mean, if noone has solved this when i get back ill do it for you.
     
  9. Unread #5 - Sep 2, 2008 at 4:12 PM
  10. Visual Basic Matt
    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056

    Visual Basic Matt Apprentice

    Vb Question...

    Problem still awaiting a solution... :(
     
  11. Unread #6 - Sep 3, 2008 at 2:19 AM
  12. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    Vb Question...

    Copy and paste this into your form, be sure to have the picture you want to hover over called Picture1 and the picture you want to appear when you hover over Picture1 called Picture2.
    Also this will only work with Picture Boxes NOT Image Boxes.

    Code:
    Option Explicit
    
    Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As Rect) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long
    
    Private Type PointAPI
        X As Long
        Y As Long
    End Type
    Private Type Rect
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
    
    Private Sub Form_Load()
        Me.ScaleMode = 3
    End Sub
    
    Private Sub tmrMouseOver_Timer()
        Dim blnMouseOver As Boolean
        Dim MousePos As PointAPI
        Dim wRect As Rect
        blnMouseOver = IsMouseOver(Picture1.hWnd)
        If blnMouseOver = True Then
            GetCursorPos MousePos
            GetWindowRect Me.hWnd, wRect
            Picture2.Left = (MousePos.X - wRect.Left)
            Picture2.Top = (MousePos.Y - wRect.Top)
            Picture2.Visible = True
        Else
            Picture2.Visible = False
        End If
    End Sub
    
    Private Function IsMouseOver(hWnd As Long) As Boolean
        Dim wRect As Rect
        Dim MousePos As PointAPI
        GetCursorPos MousePos
        GetWindowRect hWnd, wRect
        IsMouseOver = IIf((MousePos.X <= wRect.Right And MousePos.X >= wRect.Left) And (MousePos.Y <= wRect.Bottom And MousePos.Y >= wRect.Top), True, False)
    End Function
    I've also attached the project.
     

    Attached Files:

  13. Unread #7 - Sep 3, 2008 at 11:22 AM
  14. htaed
    Joined:
    Dec 19, 2005
    Posts:
    336
    Referrals:
    0
    Sythe Gold:
    0

    htaed Forum Addict
    Banned

    Vb Question...

    Nice covey :)

    Hope it all works for you
     
  15. Unread #8 - Sep 3, 2008 at 3:51 PM
  16. Visual Basic Matt
    Joined:
    Jan 29, 2008
    Posts:
    647
    Referrals:
    2
    Sythe Gold:
    56
    Discord Unique ID:
    223154494878253056

    Visual Basic Matt Apprentice

    Vb Question...

    Thanks Covey. :) You've always been a great help to me and I appreciate it greatly...

    Also, Check out the last post in my hiscore lookup thread I should be putting a newer version up there soon.
     
< Runescape Client | Login Form To Create A New Button >

Users viewing this thread
1 guest


 
 
Adblock breaks this site