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

[Feature] Moveable Forms
http://www.miragesource.net/forums/viewtopic.php?f=183&t=5938
Page 1 of 67

Author:  ExoShox [ Thu Jul 09, 2009 9:04 pm ]
Post subject:  [Feature] Moveable Forms

Difficulty: 1/5
Sides: Client Only
Tested on: MS4
Works for: MS4
Credits: Me :D
Tutorial Type: Copy and Paste

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 Picture 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
' DX/DY are the variables that define the Destination X/Y
' SPIGSS is the System Paramaters Info Action Variables used to get the Screen Size excluding the taskbar


Put the following in modDatabase under Option Explicit:
Code:
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Public Const SPIGSS = 48

Private Type CScreenRec
    Top As Long
    Left As Long
    Right As Long
    Bottom As Long
End Type

Public CScreen As CScreenRec
Public DX, DY As Long
Public OHOX, OHOY As Long
Public MouseDown As Boolean


Put the following at the very bottom of modDatabase:
Code:
Public Sub FormMove(CFrm As Form, Button As Integer, Shift As Integer, X As Long, Y As Long)

    If Button = 1 And MouseDown = True Then
        GetScreenSize
        DX = CFrm.Left + X - OHOX
        DY = CFrm.Top + Y - OHOY
        If DX < CScreen.Left Then DX = CScreen.Left
        If DY < CScreen.Top Then DY = CScreen.Top
        If DX + CFrm.Width > CScreen.Right Then DX = CScreen.Right - CFrm.Width
        If DY + CFrm.Height > CScreen.Bottom Then DY = CScreen.Bottom - CFrm.Height
        CFrm.Left = DX
        CFrm.Top = DY
    End If

End Sub

Public Sub GetScreenSize()
Dim ScreenRect As RECT
   
    SystemParametersInfo SPIGSS, 0, ScreenRect, 0
    CScreen.Bottom = 15 * ScreenRect.Bottom
    CScreen.Right = 15 * ScreenRect.Right
    CScreen.Top = 15 * ScreenRect.Top
    CScreen.Left = 15 * ScreenRect.Left
End Sub


Put The Following Code In the Form's Code Editor That you want to be able to move
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
    MouseDown = True
    OHOX = CLng(X)
    OHOY = CLng(Y)
End If
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If MouseDown = True Then Call FormMove(Me, Button, Shift, CLng(X), CLng(Y))
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    MouseDown = False
End Sub

Author:  ExoShox [ Sat Sep 05, 2009 5:48 pm ]
Post subject:  Re: [Feature] Moveable Forms

Just wondering, but why on my Transparent and Moveable Forms, and on my Moveable Image/Pic Boxes, do I have a very poor rating. I made these copy and paste, only because I don't think many people understand all the code, and I have everything explicitly stated, and I see no fault with the tutorial. So, if you are reading this, and you gave one of them a poor rating, could you please give me insight on why you did that please, so I can improve the tutorial if it needs it?

Author:  wanai [ Wed Dec 01, 2021 9:12 am ]
Post subject:  Re: [Feature] Moveable Forms

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоsemiasphalticflux.ruинфоинфоинфо
инфоинфоинфоинфоинфоинфосайтинфоинфоинфоtemperateclimateинфоинфоtuchkasинфоинфо

Author:  wanai [ Thu Jan 06, 2022 1:24 pm ]
Post subject:  Re: [Feature] Moveable Forms

Econ

Author:  wanai [ Thu Jan 06, 2022 1:25 pm ]
Post subject:  Re: [Feature] Moveable Forms

109.2

Author:  wanai [ Thu Jan 06, 2022 1:27 pm ]
Post subject:  Re: [Feature] Moveable Forms

Bett

Author:  wanai [ Thu Jan 06, 2022 1:28 pm ]
Post subject:  Re: [Feature] Moveable Forms

Bett

Author:  wanai [ Thu Jan 06, 2022 1:29 pm ]
Post subject:  Re: [Feature] Moveable Forms

musi

Author:  wanai [ Thu Jan 06, 2022 1:30 pm ]
Post subject:  Re: [Feature] Moveable Forms

Sama

Author:  wanai [ Thu Jan 06, 2022 1:31 pm ]
Post subject:  Re: [Feature] Moveable Forms

Nora

Author:  wanai [ Thu Jan 06, 2022 1:32 pm ]
Post subject:  Re: [Feature] Moveable Forms

Ross

Author:  wanai [ Thu Jan 06, 2022 1:33 pm ]
Post subject:  Re: [Feature] Moveable Forms

Gabr

Author:  wanai [ Thu Jan 06, 2022 1:34 pm ]
Post subject:  Re: [Feature] Moveable Forms

Fran

Author:  wanai [ Thu Jan 06, 2022 1:35 pm ]
Post subject:  Re: [Feature] Moveable Forms

Marv

Author:  wanai [ Thu Jan 06, 2022 1:37 pm ]
Post subject:  Re: [Feature] Moveable Forms

Fisk

Author:  wanai [ Thu Jan 06, 2022 1:38 pm ]
Post subject:  Re: [Feature] Moveable Forms

Snoo

Author:  wanai [ Thu Jan 06, 2022 1:39 pm ]
Post subject:  Re: [Feature] Moveable Forms

Rond

Author:  wanai [ Thu Jan 06, 2022 1:40 pm ]
Post subject:  Re: [Feature] Moveable Forms

hann

Author:  wanai [ Thu Jan 06, 2022 1:41 pm ]
Post subject:  Re: [Feature] Moveable Forms

Spee

Author:  wanai [ Thu Jan 06, 2022 1:42 pm ]
Post subject:  Re: [Feature] Moveable Forms

Chem

Author:  wanai [ Thu Jan 06, 2022 1:43 pm ]
Post subject:  Re: [Feature] Moveable Forms

Gran

Author:  wanai [ Thu Jan 06, 2022 1:44 pm ]
Post subject:  Re: [Feature] Moveable Forms

Plus

Author:  wanai [ Thu Jan 06, 2022 1:46 pm ]
Post subject:  Re: [Feature] Moveable Forms

Danz

Author:  wanai [ Thu Jan 06, 2022 1:47 pm ]
Post subject:  Re: [Feature] Moveable Forms

XVII

Author:  wanai [ Thu Jan 06, 2022 1:48 pm ]
Post subject:  Re: [Feature] Moveable Forms

MySQ

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