把标签放到左边就看不字了,怎么回事?请教^^

解决方案 »

  1.   

    我可以给你一段代码,因为我也遇到这个问题了/// <summary>
        /// 自定义 TabControl 的文字显示、注意:只实用于TabControl.Alignment = Right/Left.
        /// </summary>
        /// <res>注意:只实用于TabControl.Alignment = Right/Left.</res>
        public class DrawTabControlItemText
        {
            static Graphics g;
            static StringFormat strFormat;
            static Font font;
            static SolidBrush brush;
            static RectangleF tabTextArea;        public enum TabItemType
            {
                Horizontal, //  横
                Vertical,   //  竖
            }        /// <summary>
            /// 绘画Tab控件的文字.
            /// </summary>
            public static void OwnerDrawTabItem(System.Windows.Forms.TabControl tab)
            {
                tab.DrawMode = TabDrawMode.OwnerDrawFixed;
                tab.DrawItem += new DrawItemEventHandler(tab_DrawItem);
            }        /// <summary>
            /// 具体绘画方法.
            /// </summary>
            private static void tab_DrawItem(object sender, DrawItemEventArgs e)
            {
                g = e.Graphics;
                font = ((System.Windows.Forms.TabControl)sender).Font;
                brush = new SolidBrush(((System.Windows.Forms.TabControl)(sender)).TabPages[ e.Index ].ForeColor);
                strFormat = new StringFormat();
                strFormat.Alignment = StringAlignment.Center;
                strFormat.LineAlignment = StringAlignment.Center;
                tabTextArea = ((System.Windows.Forms.TabControl)sender).GetTabRect(e.Index);            g.DrawString(((System.Windows.Forms.TabControl)(sender)).TabPages[ e.Index ].Text, font, brush, tabTextArea, strFormat);
            }
        }    调用:DrawTabControlItemText.OwnerDrawTabItem(TabControl);
      

  2.   

    设置它的apperance属性,不过效果不好
      

  3.   

    重绘,只有这个方法
     
            public void tabControl_DrawItem(object sender, DrawItemEventArgs e)
            {
                Font f;
                Brush backBrush;
                Brush foreBrush;
                TabControl tabControl1 = (TabControl)sender;            if (e.Index == tabControl1.SelectedIndex)
                {
                    //f   =   new   Font(e.Font,   FontStyle.Italic   |   FontStyle.Bold); 
                    f = new Font(e.Font, FontStyle.Regular);
                    //渐变色 
                    //backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Blue, Color.Red, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
                    backBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.Blue, Color.Blue, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
                    //backBrush = new SolidBrush(Color.Coral);
                    foreBrush = Brushes.PowderBlue;
                }
                else
                {
                    f = e.Font;
                    backBrush = new SolidBrush(e.ForeColor);
                    foreBrush = new SolidBrush(e.ForeColor);
                }            //被选择的页文本 
                string tabName = tabControl1.TabPages[e.Index].Text;
                StringFormat sf = new StringFormat();
                sf.Alignment = StringAlignment.Center;            e.Graphics.FillRectangle(backBrush, e.Bounds);
                Rectangle r = e.Bounds;
                r = new Rectangle(r.X, r.Y + 3, r.Width, r.Height - 3);
                e.Graphics.DrawString(tabName, f, foreBrush, r, sf);            sf.Dispose();
                if (e.Index == tabControl1.SelectedIndex)
                {
                    f.Dispose();
                    backBrush.Dispose();
                }
                else
                {
                    backBrush.Dispose();
                    foreBrush.Dispose();
                }
            }
      

  4.   

    http://www.codeproject.com/KB/toolbars/VS_IDE_Dock_Container.aspxLZ,用这个例子吧,比系统带的好多了