Moving a picture

Discussion in 'Programming General' started by Belgin_Mage, Aug 12, 2008.

Moving a picture
  1. Unread #1 - Aug 12, 2008 at 6:47 PM
  2. Belgin_Mage
    Referrals:
    0

    Belgin_Mage Guest

    Moving a picture

    Ill try to keep this as short as I possibly can :)

    1 form, form1.borderstyle = 0 - none

    1 img, img1 is the picture on top of the form, so when you move it, the form moves. Ive tried to keep it as simple as I can:laugh: I rly need this:p
     
  3. Unread #2 - Aug 13, 2008 at 2:29 AM
  4. 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

    Moving a picture

    This is the simpliest way to do it (but not the best).
    Add this code to your Form:
    Code:
    Option Explicit
    
    Private blnMouseDown As Boolean
    Private sX As Single
    Private sY As Single
    
    Private Sub img1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
        blnMouseDown = True
        sX = x
        sY = y
    End Sub
    
    Private Sub img1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
        If blnMouseDown = True Then
            Form1.Left = Form1.Left + (x - sX)
            Form1.Top = Form1.Top + (y - sY)
        End If
    End Sub
    
    Private Sub img1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
        blnMouseDown = False
    End Sub
     
  5. Unread #3 - Aug 13, 2008 at 9:08 AM
  6. Belgin_Mage
    Referrals:
    0

    Belgin_Mage Guest

    Moving a picture

    Wow thx man! I could need someone like u to be my tutor ^^
     
< Runescape Numerator Client | runtime rich text box problem -.-" >

Users viewing this thread
1 guest


 
 
Adblock breaks this site