找回密码
 立即注册

QQ登录

只需一步,快速开始

roger.wang
社区贡献组   /  发表于:2014-5-16 10:54  /   查看:4784  /  回复:0
问题描述:选择单元格时,默认单元格会出现黑色边框来突出单元格选择的状态,如何修改指示器样式。
如图所示:


问题解答:可以通过实现IFocusIndicatorRenderer 接口,手动绘制焦点指示器。
关键代码:

  1. public class MyIndicator : FarPoint.Win.Spread.IFocusIndicatorRenderer
  2.     {
  3. public void Paint(System.Drawing.Graphics g, int x, int y, int width, int height, bool left, bool top, bool right, bool bottom)
  4.         {
  5.             SolidBrush r = new SolidBrush(System.Drawing.Color.Red);
  6.             SolidBrush b = new SolidBrush(System.Drawing.Color.Blue);
  7.             SolidBrush gr = new SolidBrush(System.Drawing.Color.DarkGreen);
  8.             g.FillRectangle(r, x, y, 1, height);
  9.             g.FillRectangle(gr, x, y, width, 1);
  10.             g.FillRectangle(r, x + width - 1, y, 1, height);
  11.             g.FillRectangle(b, x, y + height - 1, width, 1);
  12.         }
  13.     }
复制代码

?
效果截图:


示例下载:点击下载

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部