Posts tagged Mirror control
Mirror a .NET Control
1Any Control that does not support Left to right layout for RTL lanagues can be mirrored by inherting that control from a class and settings is style property to WS_EX_LAYOUTRTL and WS_EX_NOINHERITLAYOUT
Below code example is for the Tabcontrol( .NET 1.1 ) , .NET 2 TabControl already have RightToLeft property and RightToLeftLayout property
Public Class TabControlEx
Inherits TabControlConst WS_EX_LAYOUTRTL As Integer = &H400000
Const WS_EX_NOINHERITLAYOUT As Integer = &H100000Private _RTL As Boolean = False
DefaultValue(False), Localizable(True), _
Category(“Appearance”)> _
Public Property Mirrored() As Boolean
Get
Return _RTL
End GetSet(ByVal Value As Boolean)
If Not _RTL.Equals(Value) Then
_RTL = Value
MyBase.OnRightToLeftChanged(EventArgs.Empty)
End If
End Set
End PropertyProtected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim CP As System.Windows.Forms.CreateParams
CP = New System.Windows.Forms.CreateParams()
CP = MyBase.CreateParams
If Me.Mirrored Then
If Not MyBase.DesignMode() Then
CP.ExStyle = CP.ExStyle Or WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
End If
End If
Return CP
End Get
End PropertyEnd Class
Recent Comments