zoukankan      html  css  js  c++  java
  • (原)实现XtraGrid的复杂表头(中文斜线分类)

    场景:
          需要实现中文样式的复杂表头,如带斜线等。
    解决方法:
          1、使用XtraGrid中的BandedGridView视图,并在Designer界面中,添加分组表头,进行布局处理。
          2、在CustomDrawBandHeader 事件中加入如下代码:
            
     1if (e.Band.Caption == "")
     2            {
     3                e.Handled = true;
     4                e.Painter.DrawObject(e.Info);
     5
     6                Rectangle r = e.Bounds;
     7                Pen pen = Pens.Gray;
     8                e.Graphics.DrawLine(pen,new Point(r.X,r.Y),new Point(r.X+r.Width--,r.Y+r.Height-2));
     9
    10                pen = Pens.Black;
    11                Font font = new Font("宋体",12,FontStyle.Bold);
    12                Brush brush = Brushes.Black;
    13                e.Graphics.DrawString("项目",font,brush,new PointF(r.X+110,r.Y+10));
    14                e.Graphics.DrawString("航班", font, brush, new PointF(r.X + 25, r.Y + 20));
    15            }

    最终实现效果:
          
  • 相关阅读:
    [CF1106E] 边界有问题
    UOJ 67 新年的毒瘤
    BZOJ 1093 [ZJOI2007]最大半连通子图
    codeforces round#510
    codeforces round#509
    杂谈
    BZOJ 3007 [SDOI2012]拯救小云公主
    BZOJ 1799
    BZOJ 3329
    BZOJ 3209 花神的数论题
  • 原文地址:https://www.cnblogs.com/spymaster/p/942793.html
Copyright © 2011-2022 走看看