PDA

View Full Version : آموزش: RTL کردن Window در CE



senatormas
یک شنبه 09 اسفند 1388, 00:47 صبح
سلام
قول داده بودم نحوه RTL کردن رو به عزیزان یاد بدم.خودم یادم نیس اینو از کجای MSDN گیر آوردم. کسی منبع گیر آورد ضمیمه کنه!!!
طریقه استفاده بسیار راحته ناحیه RTL رو که در زیر مشخص کردم داخل مدول برنامه خودتون قرار بدین و اونو صدا بزنید هرجا نیاز بود.:بامزه:


#Region "RTL"
'SENATORMAS@GMAIL.COM
Public Const WS_EX_LAYOUTRTL As Long = 4194304
Public Const GWL_EXSTYLE As Integer = -20
<DllImport("coredll.dll", SetLastError:=True, _
CharSet:=CharSet.Unicode)> _
Public Function SetWindowLong( _
ByVal hWnd As IntPtr, _
ByVal nIndex As Integer, ByVal dwNewLong As Long) _
As Boolean
End Function

Public Function GetWindowLong( _
ByVal hWnd As IntPtr, _
ByVal nIndex As Integer) _
As Boolean
End Function
Public Sub EnableRightToLeft(ByVal c As Control)
Dim lS As Long = GetWindowLong(c.Handle, GWL_EXSTYLE)
lS = WS_EX_LAYOUTRTL
SetWindowLong(c.Handle, GWL_EXSTYLE, lS)
c.Invalidate()
End Sub

#End Region


Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
EnableRightToLeft(Me)
End Sub