Mirage Source
http://www.miragesource.net/forums/

[Feature] Moveable PictureBoxes and Images
http://www.miragesource.net/forums/viewtopic.php?f=183&t=5911
Page 1 of 46

Author:  ExoShox [ Wed Jul 01, 2009 9:44 pm ]
Post subject:  [Feature] Moveable PictureBoxes and Images

Difficulty: 1/5
Sides: Client Only
Tested on: MS4
Works for: MS4
Credits: Me :D
Tutorial Type: Copy and Paste with a Teeny bit of Modification

Description of Variables (You can copy these comments into your program for other programmers to read):
Code:
' OHOX/OHOY are the variables that define the Object Hold Offset X/Y
' MouseDown is the boolean that determines whether the Mouse is still pressed or not
' CFrm is the Current Form that the player is viewing
' CPic is the Current PictureBox that the player is trying to Move
' CImg is the Current Image that the player is trying to Move
' DX/DY are the variables that define the Destination X/Y



Put the following in modDatabase under Option Explicit:
Code:
Public DX, DY as Long
Public OHOX, OHOY As Long
Public MouseDown As Boolean


Put The Following Code In the Form's Code Editor (Whichever form contains the picture you want to move) And Replace the <PicName>'s with the name of the Picture you want to move:
Code:
Private Sub <PicName>_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    OHOX = X
    OHOY = Y
    MouseDown = True
End Sub

Private Sub <PicName>_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If MouseDown = True Then Call PicMove(Me, Me.<PicName>, Button, Shift, CLng(X), CLng(Y))
End Sub

Private Sub <PicName>_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    MouseDown = False
End Sub


Put The Following Code In the Form's Code Editor (Whichever form contains the image you want to move) And Replace the <ImgName>'s with the name of the Img you want to move:
Code:
Private Sub <ImgName>_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    OHOX = X
    OHOY = Y
    MouseDown = True
End Sub

Private Sub <ImgName>_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If MouseDown = True Then Call ImgMove(Me, Me.<ImgName>, Button, Shift, CLng(X), CLng(Y))
End Sub

Private Sub <ImgName>_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    MouseDown = False
End Sub


And Put this in modDatabase at the bottom:
Code:
Public Sub PicMove(CFrm As Form, CPic As PictureBox, Button As Integer, Shift As Integer, X As Long, Y As Long)
   
    If Button = 1 Then
        DX = CPic.Left + X - OHOX
        DY = CPic.Top + Y - OHOY
        If DX < 0 Then DX = 0
        If DY < 0 Then DY = 0
        If DX + CPic.Width > CFrm.ScaleWidth Then DX = CFrm.ScaleWidth - CPic.Width
        If DY + CPic.Height > CFrm.ScaleHeight Then DY = CFrm.ScaleHeight - CPic.Height
        CPic.Left = DX
        CPic.Top = DY
    End If
End Sub

Public Sub ImgMove(CFrm As Form, CImg As Image, Button As Integer, Shift As Integer, X As Long, Y As Long)
   
    If Button = 1 Then
        DX = CImg.Left + X - OHOX
        DY = CImg.Top + Y - OHOY
        If DX < 0 Then DX = 0
        If DY < 0 Then DY = 0
        If DX + CImg.Width > CFrm.ScaleWidth Then DX = CFrm.ScaleWidth - CImg.Width
        If DY + CImg.Height > CFrm.ScaleHeight Then DY = CFrm.ScaleHeight - CImg.Height
        CFrm.ScaleMode = 1
        CImg.Left = DX
        CImg.Top = DY
    End If
End Sub

Author:  wanai [ Wed Dec 01, 2021 9:10 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтsemiasphalticfluxсайтсайтсайт
сайтсайтсайтсайтсайтсайтhttp://taskreasoning.ruсайтсайтсайтинфосайтсайтtuchkasсайтсайт

Author:  wanai [ Thu Jan 06, 2022 9:15 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Econ

Author:  wanai [ Thu Jan 06, 2022 9:16 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

107.1

Author:  wanai [ Thu Jan 06, 2022 9:17 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Bett

Author:  wanai [ Thu Jan 06, 2022 9:18 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Bett

Author:  wanai [ Thu Jan 06, 2022 9:20 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Stan

Author:  wanai [ Thu Jan 06, 2022 9:21 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Henr

Author:  wanai [ Thu Jan 06, 2022 9:22 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Piet

Author:  wanai [ Thu Jan 06, 2022 9:23 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Fred

Author:  wanai [ Thu Jan 06, 2022 9:24 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Defo

Author:  wanai [ Thu Jan 06, 2022 9:25 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Pari

Author:  wanai [ Thu Jan 06, 2022 9:26 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Guit

Author:  wanai [ Thu Jan 06, 2022 9:27 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Dorm

Author:  wanai [ Thu Jan 06, 2022 9:28 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

John

Author:  wanai [ Thu Jan 06, 2022 9:30 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Orie

Author:  wanai [ Thu Jan 06, 2022 9:31 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Edwa

Author:  wanai [ Thu Jan 06, 2022 9:32 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Shin

Author:  wanai [ Thu Jan 06, 2022 9:33 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Dead

Author:  wanai [ Thu Jan 06, 2022 9:34 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Pale

Author:  wanai [ Thu Jan 06, 2022 9:35 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Jewe

Author:  wanai [ Thu Jan 06, 2022 9:36 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Ston

Author:  wanai [ Thu Jan 06, 2022 9:37 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Frit

Author:  wanai [ Thu Jan 06, 2022 9:39 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

NULL

Author:  wanai [ Thu Jan 06, 2022 9:40 am ]
Post subject:  Re: [Feature] Moveable PictureBoxes and Images

Craz

Page 1 of 46 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/