如何实现DevExpress XtraGrid数据集更新
1个回答
展开全部
能否当鼠标悬停在某一个单元格时,鼠标光标显示为手型光标,并且改变网格行的外观?
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
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
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询