zoukankan      html  css  js  c++  java
  • TabControl控件在左侧绘制tabPage页面

    效果图:

    代码:

    1.设置控件属性

       tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
       tabControl1.Alignment = TabAlignment.Left;
       tabControl1.SizeMode = TabSizeMode.Fixed;
       tabControl1.Multiline = true;
       tabControl1.ItemSize = new Size(50, 100);

    2.设置事件

           private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
            {
                Rectangle tabArea = tabControl1.GetTabRect(e.Index);//主要是做个转换来获得TAB项的RECTANGELF
                RectangleF tabTextArea = (RectangleF)(tabControl1.GetTabRect(e.Index));
                Graphics g = e.Graphics;
                StringFormat sf = new StringFormat();//封装文本布局信息
                sf.LineAlignment = StringAlignment.Center;
                sf.Alignment = StringAlignment.Center;
                Font font = this.tabControl1.Font;
                SolidBrush brush = new SolidBrush(Color.Black);//绘制边框的画笔
                g.DrawString(((TabControl)(sender)).TabPages[e.Index].Text, font, brush, tabTextArea, sf);
            }

  • 相关阅读:
    Bzoj 2820: YY的GCD(莫比乌斯反演+除法分块)
    Cogs 2221. [SDOI2016 Round1] 数字配对(二分图)
    Cogs 750. 栅格网络(对偶图)
    最小环问题
    浅谈卡特兰数
    洛谷 P1744 采购特价商品
    HDU 1212 Big Number
    HDU 2108 Shape of HDU
    HDU 1029 Ignatius and the Princess IV
    HDU 1021 Fibonacci Again
  • 原文地址:https://www.cnblogs.com/shenbing/p/5830565.html
Copyright © 2011-2022 走看看