Möchte ein UserForm neben einem TextFeld eines anderen Userforms positionieren
In einem Modul lese ich mittels nachstehendem Code die aktuelle Position der Mouse aus
Type POINTAPI
Xcoord As Long
Ycoord As Long
End Type
#If Win64 Then
Private Declare PtrSafe Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
#Else
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
#End If
Sub GetCursorPosDemo()
Dim llCoord As POINTAPI
' Get the cursor positions
GetCursorPos llCoord
' Display the cursor position coordinates
MsgBox "X Position: " & llCoord.Xcoord & vbNewLine & "Y Position: " & llCoord.Ycoord
End Sub
Mit folgendem Code positioniere ich ein UserForm
With Me
.Left = xLeft
.Top = xTop
End With
Setze ich jetzt die Positionswerte aus llCoord.Xcoord in XLeft unf llCoord.Ycoord in XTop ein, wird das Userform viel zu weit rechts und unten positioniert - warum - was mache ich falsch?
|