By default .Net Toolstrip control not render the text for RightToLeft languages correctly, I written a class to do so. All is well else after drawing graphics all the menus of toolstrip which are containing "&" not render correctly. Any help will be appreciated.
Attachment 93101
Here is the class.
Usage
Attachment 93101
Here is the class.
PHP Code:
Namespace UrduTextRendrer
Public Class UrduTextRendrer
Inherits ToolStripProfessionalRenderer
Protected Overrides Sub OnRenderItemText(ByVal e As ToolStripItemTextRenderEventArgs)
Dim sf As New StringFormat()
If (e.TextFormat And TextFormatFlags.RightToLeft) <> 0 Then
sf.FormatFlags = StringFormatFlags.DirectionRightToLeft
End If
Using brush = New SolidBrush(e.TextColor)
e.Graphics.DrawString(e.Text, e.TextFont, brush, New RectangleF(e.TextRectangle.Location, e.TextRectangle.Size), sf)
End Using
End Sub
End Class
End Namespace
Usage
PHP Code:
ToolStripManager.Renderer = New UrduTextRendrer.UrduTextRendrer