| | |
| | | /// </summary> |
| | | public static class GridViewExtensions |
| | | { |
| | | /// <summary> |
| | | /// 根据 client point 获取行索引 |
| | | /// </summary> |
| | | public static int GetRowHandleByCP(this GridView grid, Point cp) |
| | | { |
| | | Point pt = grid.GridControl.PointToClient(cp); |
| | | var hitInfo = grid.CalcHitInfo(pt); |
| | | return hitInfo.RowHandle; |
| | | } |
| | | |
| | | #region 默认 |
| | | |
| | | /// <summary> |
| | |
| | | grid.OptionsClipboard.AllowCopy = DefaultBoolean.True; |
| | | grid.OptionsBehavior.Editable = false; |
| | | grid.OptionsBehavior.ReadOnly = true; |
| | | |
| | | |
| | | |
| | | |
| | | grid.OptionsView.EnableAppearanceOddRow = true; // 使能 // 和和上面绑定 同时使用有效 |
| | | grid.Appearance.EvenRow.BackColor = Color.FromArgb(244, 248, 251); // 设置偶数行颜色 |
| | |
| | | grid.OptionsView.EnableAppearanceEvenRow = true; |
| | | grid.Appearance.OddRow.BackColor = Color.White; // 设置偶数行颜色 |
| | | |
| | | |
| | | grid.RowHeight = height; |
| | | grid.ColumnPanelRowHeight = height; |
| | | grid.GroupRowHeight = height; |
| | |
| | | grid.Appearance.OddRow.BackColor = Color.White; |
| | | grid.Appearance.EvenRow.BackColor = Color.FromArgb(244, 248, 251); |
| | | |
| | | |
| | | grid.RowHeight = height; |
| | | grid.ColumnPanelRowHeight = height; |
| | | grid.GroupRowHeight = height; |
| | |
| | | grid.Appearance.EvenRow.BackColor = Color.FromArgb(244, 248, 251); // 设置偶数行颜色 |
| | | grid.OptionsView.EnableAppearanceEvenRow = true; |
| | | grid.Appearance.OddRow.BackColor = Color.White; // 设置偶数行颜色 |
| | | |
| | | |
| | | grid.RowHeight = height; |
| | | grid.ColumnPanelRowHeight = height; |
| | |
| | | grid.ColumnPanelRowHeight = height; |
| | | grid.GroupRowHeight = height; |
| | | grid.BestFitColumns(); |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return row; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 默认 |
| | | |
| | | /// <summary> |
| | | /// 绑定按列分组视图设置 Nsx_20210729 |
| | |
| | | grid.BestFitColumns(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 普通编辑视图设置 |
| | | /// </summary> |
| | |
| | | grid.Appearance.OddRow.BackColor = Color.White; |
| | | grid.Appearance.EvenRow.BackColor = Color.FromArgb(244, 248, 251); |
| | | |
| | | |
| | | grid.RowHeight = height; |
| | | grid.ColumnPanelRowHeight = height; |
| | | grid.GroupRowHeight = height; |
| | | grid.BestFitColumns(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置拖拽状态下的普通视图 |
| | | /// </summary> |
| | | /// </summary> |
| | | public static void SetDragNormalView<t>(this GridView rhs, int height = 30) where t : class |
| | | { |
| | | rhs.SetNormalView(height); |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | rhs.MouseMove += (sender, e) => |
| | | { |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |