tabcontrol不给力,标题不能改解决方法。直接上源码,不注释。

            Rectangle tabArea1;
            Rectangle tabArea2;
            RectangleF tabTextArea1;
            RectangleF tabTextArea2;
            tabArea1 = tabControl1.GetTabRect(0);
            tabArea2 = tabControl1.GetTabRect(1); ;
            tabTextArea1 = (RectangleF)tabControl1.GetTabRect(0);
            tabTextArea2 = (RectangleF)tabControl1.GetTabRect(1);
            Graphics g = e.Graphics;
            Pen p = new Pen(Color.Black);
            Font font = new Font("宋体", 9.0f);
            SolidBrush brush = new SolidBrush(Color.Silver);
            e.Graphics.FillRectangle(brush, tabControl1.Bounds);

             brush = new SolidBrush(Color.LightGray);
            e.Graphics.FillRectangle(brush, e.Bounds);
            brush = new SolidBrush(Color.WhiteSmoke);
            g.FillRectangle(brush, tabTextArea1);
 
            g.FillRectangle(brush, tabTextArea2);
            brush = new SolidBrush(Color.Black);
            StringFormat sf = new StringFormat();

            sf.LineAlignment = StringAlignment.Center;
            sf.Alignment = StringAlignment.Center;


            g.DrawString("  酒店管理  ", font, brush, tabTextArea1, sf);
            g.DrawString("酒店区域管理", font, brush, tabTextArea2, sf);

你可能感兴趣的:(tabcontrol不给力,标题不能改解决方法。直接上源码,不注释。)