找回密码
 立即注册

QQ登录

只需一步,快速开始

GARYYOU

葡萄城公司职员

3

主题

8

帖子

1007

积分

葡萄城公司职员

积分
1007

活字格认证

最新发帖
GARYYOU
葡萄城公司职员   /  发表于:2013-12-18 16:43  /   查看:5849  /  回复:3
如图1,Spread列的celltype属性被设置为了ComboBoxCellType,我想将combobox右边的按钮式样变更一下,把它变成平的(如图2),不知道有没有办法?
图1:
pic.png
图2:
pic2.png

3 个回复

倒序浏览
roger.wang
社区贡献组   /  发表于:2013-12-18 16:59:00
沙发
回复 1楼GARYYOU的帖子

应该可以,不过要自定义一个CellType,继承自ComBoxCellType
重写PaintCell函数,这行代码ControlPaint.DrawComboButton用来画Combox的下拉箭头的。

  1.         
  2. public override void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
  3.         {
  4.             
  5.             if (value != null)
  6.             {
  7.       
  8.                 g.DrawString(value.ToString(), appearance.Font, new SolidBrush(Color.Black), new PointF(r.X + 20, r.Y - 10 + 10));
  9.                 ControlPaint.DrawComboButton(g, new Rectangle(r.Right - 17, r.Y, 17, r.Height), ButtonState.Flat);
  10.             }
  11.             else
  12.             {
  13.                 base.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor);
  14.             }
  15.         }
复制代码
回复 使用道具 举报
GARYYOU
葡萄城公司职员   /  发表于:2013-12-18 17:04:00
板凳
明白了,非常谢谢!
回复 使用道具 举报
roger.wang
社区贡献组   /  发表于:2013-12-18 17:15:00
地板
回复 3楼GARYYOU的帖子

客气 :g~ij:
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部