Click here to Skip to main content
15,884,298 members

How Use Draw Item Event of Tabcontrol when we convert the language from English to Arabic in windows application with c#

Anil Honey 206 asked:

Open original thread
Dear Friends,

Here i Developed an Application of Which we are Converting the language from English to Arabic All Controls are working fine.But in the case of TabControl when iam converting the tab layout from right to left in Arabic language the tabpage is not changing from Left Side.Actually when language changes tab page should display on right side.Actually For Dispalying Close Button on Tab control i use to dray the Icon on Tabpage For that i have written a code.

C#
private void rptEvaluationReport_Ar_Load(object sender, EventArgs e)
     {

         try
         {
             PreRemoveTabPage2 = null;
            

             #endregion
             DrawEvaluationTextual();
             this.tabControl_Textual.DrawMode = TabDrawMode.OwnerDrawFixed;
            

         }
         catch
         {

         }

        
     }



C#
private void DrawEvaluationTextual()
      {
          Bitmap bmp = new Bitmap(16, 16);
          using (Graphics g = Graphics.FromImage(bmp))
          {
              g.Clear(Color.Red);
              using (SolidBrush sb = new SolidBrush(this.tabControl_Textual.TabPages[0].ForeColor))
                  g.DrawString("x", this.tabControl_Textual.Font, sb, new PointF(2, 0));

          }

          this.imageList1.Images.Add(bmp);
          this.tabControl_Textual.ImageList = this.imageList1;

          foreach (TabPage t in tabControl_Textual.TabPages)
          {
              t.UseVisualStyleBackColor = true;
              t.ImageIndex = 0;
          }
      }


And for Draw Item i have written a code of

C#
private void tabControl_Textual_DrawItem(object sender, DrawItemEventArgs e)
      {
              using (SolidBrush sb = new SolidBrush(this.tabControl_Textual.TabPages[0].ForeColor))
              {
                  e.Graphics.DrawString(this.tabControl_Textual.TabPages[e.Index].Text,
                    this.tabControl_Textual.Font, sb,
                    new PointF(e.Bounds.X + 4, 4));
              }
              e.Graphics.DrawImage(
                this.imageList1.Images[0],
                e.Bounds.X + e.Bounds.Width - this.imageList1.Images[0].Width - 1,
                4);

      }


This code is working fine For English Language But when i convert the language to Arabic the tab page is not displaying on Right side.So where i have done a mistake if anything like that please share with me.




Regards,

AnilKumar.D
Tags: C# (C# 4.0)

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900