·  Start ·  Programme ·  Codes ·  Tipps ·  ActiveX ·  Tutorials · 



Erstellen Sie zwei Commandbuttons auf einem Formular. Mit der folgenden Funktion "SetCurs" wird automatisch beim Ereignis Form_Activate der Cursor auf die Mitte des Commandbuttons gesetzt.

Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long 
Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long 

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

Private Sub SetCurs(ctl As Control)
Dim hWnd As Long 
Dim tRect As RECT
  hWnd = ctl.hWnd
  GetWindowRect hWnd, tRect
  SetCursorPos tRect.Left + ((tRect.Right - tRect.Left) / 2), tRect.Top + ((tRect.Bottom - tRect.Top) / 2)
 
End Sub 

Private Sub Form_Activate()
    SetCurs Command1
End Sub 
Aktualisiert: 12.02.2008, 14:10 Uhr Copyright © 2001 - 2010 by ST-software Navigation zurück  |  Navigation vorwärts  |  Zum Seitenanfang     
Ihre IP: 38.107.191.84 ·  Seite erstellt in: 0.497 Sekunden ·  Dateigröße:  2709 Bytes