tabcontrol align with visual effect problem

i have encountered the tabcontrol align problem. with the visual effect set to true, the tab text stay horizontal no matter how i aligned the tab to left, right or bottom. how can i fix it

i hv encounter the same problem when using VS.net 2003 with the manifest file attached to enable the visual effect. any advices/guides are welcomed. thanks



Answer this question

tabcontrol align with visual effect problem

  • Chandru

    There are websites around that will convert that small a code snippet for you, but it's pretty straightforward.

     



  • BlkShdw88

    im not familiar with rotate and translate transform. cgraus, can u show me the way thanks cgraus.

    is there any other ways to beat it is it a problem/bug that the vb team dont realise until today


  • Gaturam

    It's a problem in the tab control, in C# and VB.NET.  It's been there for ages.  I created a class derived from TabControl and added a method to the DrawItem event, which contained this code:

     

    Rectangle rcTab = GetTabRect(e.Index);

    SizeF szText = e.Graphics.MeasureString(text, tab.Font);

    e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

    if (tab.ImageIndex >= 0)

    {

    e.Graphics.DrawImage(ImageList.Images[tab.ImageIndex], rcTab.Left, rcTab.Bottom - rcTab.Width, rcTab.Width, rcTab.Width);

    }

    e.Graphics.TranslateTransform(rcTab.Left, rcTab.Top + szText.Width );

    e.Graphics.RotateTransform(270);

    e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

    e.Graphics.DrawString(text, internalFont, Brushes.Black, -12, 5);

    e.Graphics.ResetTransform();

     

    This will draw the label and the icon on the tab.  It assumes there is an icon, as there always is, in my code.



  • Jelle van der Beek30865

    cgraus, thanks for the code. it seem it is written in C#. i will try to translate it to VB cos im not familiar with C#.
  • Anthony Kautz

    I found the tab control in .NET to have all sorts of issues when you deviate from drawing a standard, tabs on top, horizontal text, tab control.  I beat it by making the text owner drawn and using a rotate and translate transform to draw my text so it reads from the bottom of the screen to the top.

     



  • tabcontrol align with visual effect problem