和开发确认,那个是我们的设计,内部有逻辑要处理,不能干预。可以通过自定义单元格实现
- var mct = new CustomMaskCellType();
-
- public class CustomGeneralEditor : GeneralEditor
- {
- protected override InputTextBox GetInputTextBox()
- {
- var inputTextBox = new CustomInputTextBox();
- inputTextBox.BackColor = BackColor;
- inputTextBox.ForeColor = ForeColor;
- inputTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
- inputTextBox.Font = Font;
- inputTextBox.AcceptsReturn = false;
- inputTextBox.AcceptsTab = false;
- inputTextBox.Multiline = false;
- inputTextBox.Name = "InputTextBox_Internal";
- inputTextBox.Parent = this;
- inputTextBox.Visible = true;
- inputTextBox.TabStop = false;
- inputTextBox.ReadOnly = false;
- inputTextBox.AutoSize = false;
- inputTextBox.EditModeCursorPosition = EditModeCursorPosition.MouseLocation;
- return inputTextBox;
- }
- }
-
- public class CustomInputTextBox : FarPoint.Win.InputTextBox
- {
- protected override bool SEditProcessWmCharMsg(ref Message msg)
- {
- char inputChar = (char)msg.WParam.ToInt32();
- if ('a' <= inputChar && inputChar <= 'z')
- {
- msg.WParam = new IntPtr(char.ToUpper(inputChar));
- }
- return base.ProcessWMCharMsg(ref msg);
- }
- }
-
- public class CustomMaskCellType : MaskCellType
- {
- public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
- {
- CustomGeneralEditor editor = new CustomGeneralEditor();
- InitializeEditorControl(editor, appearance, zoomFactor);
- return editor;
- }
- }
复制代码 |