1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public Sub MousePlaceSourisForm(ByVal ScaleX As Long, ByVal ScaleY As Long, ByRef FormParent As Form, Optional ModePositionXY As ScaleModeConstants = vbTwips)
Dim Xpos As Long
Dim Ypos As Long
Dim TailleBordure As Long
Dim TailleTitre As Long
TailleBordure = FormParent.ScaleX(FormParent.Width, vbTwips, vbPixels)
TailleBordure = TailleBordure - FormParent.ScaleX(FormParent.ScaleWidth, FormParent.ScaleMode, vbPixels)
TailleBordure = TailleBordure / 2
TailleTitre = FormParent.ScaleY(FormParent.Height, vbTwips, vbPixels)
TailleTitre = TailleTitre - FormParent.ScaleY(FormParent.ScaleHeight, FormParent.ScaleMode, vbPixels)
TailleTitre = TailleTitre - TailleBordure
Xpos = FormParent.ScaleX(ScaleX, ModePositionXY, vbPixels)
Xpos = Xpos + FormParent.ScaleX(FormParent.left, vbTwips, vbPixels) + TailleBordure
Ypos = FormParent.ScaleY(ScaleY, ModePositionXY, vbPixels)
Ypos = Ypos + FormParent.ScaleY(FormParent.tOp, vbTwips, vbPixels) + TailleTitre
SetCursorPos Xpos, Ypos
End Sub |
Partager