尝试这个解决方案,看是否能让你们的客户满意。
1. 自定义一个MyNumberCell从NumericUpDownCell派生 (代码在后边给出)
2. 全工程查找“NumericUpDownCell”,替换为“MyNumberCell”
VB:- Class MyNumberCell
- Inherits NumericUpDownCell
- Public Sub New()
- Me.ShowSpinButton = CellButtonVisibility.NotShown
- End Sub
- Protected Overrides Function GetEditingControlBounds(ByVal cellBounds As Rectangle, ByVal rowIndex As Integer) As Rectangle
- Dim bounds As Rectangle = MyBase.GetEditingControlBounds(cellBounds, rowIndex)
- Return New Rectangle(bounds.X, bounds.Y, bounds.Width + SystemInformation.VerticalScrollBarWidth, bounds.Height)
- End Function
- End Class
复制代码
C#- class MyNumberCell : NumericUpDownCell
- {
- public MyNumberCell()
- {
- this.ShowSpinButton = CellButtonVisibility.NotShown;
- }
- protected override Rectangle GetEditingControlBounds(Rectangle cellBounds, int rowIndex)
- {
- Rectangle bounds = base.GetEditingControlBounds(cellBounds, rowIndex);
- return new Rectangle(bounds.X, bounds.Y, bounds.Width + SystemInformation.VerticalScrollBarWidth, bounds.Height);
- }
- }
复制代码 |