Postup:
Zalo₧te nov² projekt. V
deklaraΦnφ sekci formulß°e napiÜte:
'Zarovnßvacφ konstanty
Private Const BS_CENTER& = &H300&
Private Const BS_LEFT& = &H100&
Private Const BS_RIGHT& = &H200&
Private Const BS_TOP& = &H400&
Private Const GWL_STYLE& = (-16)
'API
Private Declare Function GetWindowLong& Lib "user32" Alias
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long)
Private Declare Function SetWindowLong& Lib "user32" Alias
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal
dwNewLong As Long)
Na formulß° p°idejte tlaΦφtko
a check box. Na udßlost click checkboxu:
Private Sub Check1_Click()
Dim tmpValue&
Dim Align&
Dim ret&
If Check1.Value = Checked Then
fAlignment& = BS_LEFT
tmpValue& = GetWindowLong&(Command1.hwnd,
GWL_STYLE) And Not BS_RIGHT
ret& = SetWindowLong&(Command1.hwnd,
GWL_STYLE, tmpValue& Or fAlignment&)
Command1.Refresh
Else
fAlignment& = BS_CENTER
tmpValue& = GetWindowLong&(Command1.hwnd,
GWL_STYLE) And Not BS_RIGHT Or BS_LEFT
ret& = SetWindowLong&(Command1.hwnd,
GWL_STYLE, tmpValue& Or fAlignment&)
Command1.Refresh
End If
End Sub
Spus¥te aplikaci a zkuste
p°epφnat checkbox.
|