Results 1 to 13 of 13

Thread: [RESOLVED] Text Renderer Class For Arabic Script Languages

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    99

    Resolved [RESOLVED] Text Renderer Class For Arabic Script Languages

    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.

    Name:  error.png
Views: 957
Size:  16.5 KB

    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.Texte.TextFontbrush, New RectangleF(e.TextRectangle.Locatione.TextRectangle.Size), sf)
                
    End Using
            End Sub
        End 
    Class
    End Namespace 

    Usage
    PHP Code:
    ToolStripManager.Renderer = New UrduTextRendrer.UrduTextRendrer 
    Last edited by hackerspk; Nov 11th, 2012 at 02:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width