thinBasic Code:
Public Sub MoveCtl( _
oCtl As Object, _
ByVal Left As Single, _
Optional Top As Variant, _
Optional Width As Variant, _
Optional Height As Variant)
Const FUNC_NAME As String = "MoveCtl"
Dim oCtlExt As VBControlExtender
On Error GoTo EH
If oCtl Is Nothing Then
Exit Sub
End If
If TypeOf oCtl Is VBControlExtender Then
Set oCtlExt = oCtl
If IsMissing(Top) Then
If oCtlExt.Left <> Left Then
oCtlExt.Move Left
End If
ElseIf IsMissing(Width) Then
If oCtlExt.Left <> Left Or oCtlExt.Top <> Top Then
oCtlExt.Move Left, Top
End If
ElseIf IsMissing(Height) Then
If oCtlExt.Left <> Left Or oCtlExt.Top <> Top Or oCtlExt.Width <> Limit(Width, 0) Then
If 1440 \ ScreenTwipsPerPixelX = 1440 / ScreenTwipsPerPixelX Then
oCtlExt.Move Left, Top, Limit(Width, 0)
ElseIf oCtlExt.Left <> Left Or oCtlExt.Top <> Top Then
oCtlExt.Move oCtlExt.Left, oCtlExt.Top, Limit(Width, 0)
oCtlExt.Move Left, Top
Else
oCtlExt.Move Left + ScreenTwipsPerPixelX, Top, Limit(Width, 0)
oCtlExt.Move Left
End If
End If
Else
If oCtlExt.Left <> Left Or oCtlExt.Top <> Top Or oCtlExt.Width <> Limit(Width, 0) Or oCtlExt.Height <> Limit(Height, 0) Then
If 1440 \ ScreenTwipsPerPixelX = 1440 / ScreenTwipsPerPixelX Then
oCtlExt.Move Left, Top, Limit(Width, 0), Limit(Height, 0)
ElseIf oCtlExt.Left <> Left Or oCtlExt.Top <> Top Then
oCtlExt.Move oCtlExt.Left, oCtlExt.Top, Limit(Width, 0), Limit(Height, 0)
oCtlExt.Move Left, Top
Else
oCtlExt.Move Left + ScreenTwipsPerPixelX, Top, Limit(Width, 0), Limit(Height, 0)
oCtlExt.Move Left
End If
End If
End If
Else
If IsMissing(Top) Then
If oCtl.Left <> Left Then
oCtl.Move Left
End If
ElseIf IsMissing(Width) Then
If oCtl.Left <> Left Or oCtl.Top <> Top Then
oCtl.Move Left, Top
End If
ElseIf IsMissing(Height) Then
If oCtl.Left <> Left Or oCtl.Top <> Top Or oCtl.Width <> Limit(Width, 0) Then
If 1440 \ ScreenTwipsPerPixelX = 1440 / ScreenTwipsPerPixelX Then
oCtl.Move Left, Top, Limit(Width, 0)
ElseIf oCtl.Left <> Left Or oCtl.Top <> Top Then
oCtl.Move oCtl.Left, oCtl.Top, Limit(Width, 0)
oCtl.Move Left, Top
Else
oCtl.Move Left + ScreenTwipsPerPixelX, Top, Limit(Width, 0)
oCtl.Move Left
End If
End If
Else
If oCtl.Left <> Left Or oCtl.Top <> Top Or oCtl.Width <> Limit(Width, 0) Or oCtl.Height <> Limit(Height, 0) Then
If 1440 \ ScreenTwipsPerPixelX = 1440 / ScreenTwipsPerPixelX Then
oCtl.Move Left, Top, Limit(Width, 0), Limit(Height, 0)
ElseIf oCtl.Left <> Left Or oCtl.Top <> Top Then
oCtl.Move oCtl.Left, oCtl.Top, Limit(Width, 0), Limit(Height, 0)
oCtl.Move Left, Top
Else
oCtl.Move Left + ScreenTwipsPerPixelX, Top, Limit(Width, 0), Limit(Height, 0)
oCtl.Move Left
End If
End If
End If
End If
Exit Sub
EH:
RaiseError FUNC_NAME
End Sub
. . . where