如何实现DevExpress XtraGrid数据集更新

 我来答
蘑菇饭资讯
2014-11-24 · TA获得超过6万个赞
知道大有可为答主
回答量:1.7万
采纳率:90%
帮助的人:1.2亿
展开全部
能否当鼠标悬停在某一个单元格时,鼠标光标显示为手型光标,并且改变网格行的外观?
private int HotTrackRow { get { return hotTrackRow; } set { if(hotTrackRow != value) { int prevHotTrackRow = hotTrackRow; hotTrackRow = value; gridView1.RefreshRow(prevHotTrackRow); gridView1.RefreshRow(hotTrackRow); if(hotTrackRow >= 0) gridControl1.Cursor = Cursors.Hand; else gridControl1.Cursor = Cursors.Default; } }}private void gridView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { GridView view = sender as GridView; GridHitInfo info = view.CalcHitInfo(new Point(e.X, e.Y)); if(info.InRowCell) HotTrackRow = info.RowHandle; else HotTrackRow = DevExpress.XtraGrid.GridControl.InvalidRowHandle;} private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { if(e.RowHandle == HotTrackRow) e.Appearance.BackColor = Color.PaleGoldenrod;}[VB.NET]Imports DevExpress.XtraGridImports DevExpress.XtraGrid.Views.Grid Private HotTrackRowValue As Integer = GridControl.InvalidRowHandle Private Property HotTrackRow() As Integer Get Return HotTrackRowValue End Get Set(ByVal Value As Integer) If HotTrackRowValue Value Then Dim PrevHotTrackRow As Integer PrevHotTrackRow = HotTrackRowValue HotTrackRowValue = Value GridView1.RefreshRow(PrevHotTrackRow) GridView1.RefreshRow(HotTrackRowValue) If HotTrackRowValue >= 0 Then GridControl1.Cursor = Cursors.Hand Else GridControl1.Cursor = Cursors.Default End If End If End SetEnd PropertyPrivate Sub GridView1_MouseMove(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles GridView1.MouseMove Dim View As GridView = CType(sender, GridView) With View.CalcHitInfo(New Point(e.X, e.Y)) If .InRowCell Then HotTrackRow = .RowHandle Else HotTrackRow = GridControl.InvalidRowHandle End If End WithEnd Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式