Zarovnßnφ titulku okna doprava

Postup:
V deklaraΦnφ Φßsti formulß°e zapiÜte:

Private Declare Function GetWindowLong Lib "user32" Alias _
   "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" _
   (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, _
   ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, _
   ByVal wFlags As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
   "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
   ByVal dwNewLong As Long) As Long

Private Const GWL_EXSTYLE = -20
Private Const SWP_NOZORDER = 4
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const WS_EX_LAYOUTRTL = &H400000
Private Const WS_EX_RIGHT = &H1000

 
Private Sub SetWindowStyleEx (wnd As Long, NewStyle As Long, _
   fAdd As Boolean, Optional fRedraw As Boolean = True)

   Dim CurStyle As Long

   CurStyle = GetWindowLong(wnd, GWL_EXSTYLE)
   If fAdd And (CurStyle And NewStyle) = 0 Then
      CurStyle = CurStyle Or NewStyle
   ElseIf (Not fAdd) And (CurStyle And NewStyle) Then
      CurStyle = CurStyle And (Not NewStyle)
   End If

   SetWindowLong wnd, GWL_EXSTYLE, CurStyle

   If fRedraw Then
      SetWindowPos wnd, 0, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOMOVE _
         Or SWP_NOSIZE
   End If

End Sub

Na formulß° p°idejte dv∞ tlaΦφtka a na jejich udßlost Click:
Private Sub Command1_Click()

   
'Zarovnß titulek okna na pravou stranu
   Static OnOff As Boolean

   OnOff = Not (OnOff)
   SetWindowStyleEx Me.hWnd, WS_EX_RIGHT, OnOff, True

End Sub
 
Private Sub Command2_Click()

   
'Kompletn∞ zrcadlov∞ p°ehodφ zßhlavφ okna
   Static OnOff As Boolean

   OnOff = Not (OnOff)
   SetWindowStyleEx Me.hWnd, WS_EX_LAYOUTRTL, OnOff, True

End Sub

Zp∞t

Autor: The Bozena