DevExpress WinForm GridView 焦点行显示下划线高亮

Lassie ·
更新时间:2024-11-13
· 956 次阅读

欲实现以下效果,请直接调用中的方法,在构造函数或者界面加载的时候调用即可

/// /// 焦点行下划线 /// /// void DrawRowLine(GridControl grid) { grid.Paint += (s, e) => { GridView gridView = grid.FocusedView as GridView; GridViewInfo viewinfo = gridView1.GetViewInfo() as GridViewInfo; GridViewRects gridViewRects = viewinfo.ViewRects; var focusedRowInfo = gridViewRects.ViewInfo.RowsInfo.GetInfoByHandle(gridView.FocusedRowHandle); if (focusedRowInfo != null) { var r = focusedRowInfo.DataBounds; Point p1 = new Point(r.X, r.Y + r.Height); Point p2 = new Point(r.X + r.Width, r.Y + r.Height); var pen = new Pen(Color.Yellow); pen.Width = 2; e.Graphics.DrawLine(pen, p1, p2); } }; (grid.FocusedView as GridView).FocusedRowChanged += (s, e) => { grid.Refresh(); }; }

调用方法演示:


作者:涛神-Dev



ie 下划线 orm 高亮 res id rm pr ss pre

需要 登录 后方可回复, 如果你还没有账号请 注册新账号