回复 3楼miyaminn的帖子
尝试以下Code:- public Form2()
- {
- InitializeComponent();
- this.gcNumber1.TextChanging += gcNumber1_TextChanging;
- }
- void gcNumber1_TextChanging(object sender, GrapeCity.Win.Editors.TextChangingEventArgs e)
- {
- this.gcNumber1.ValueSign = GrapeCity.Win.Editors.ValueSignControl.NoControl;
- if (this.gcNumber1.SelectionLength == this.gcNumber1.TextLength)
- {
- if (gcNumber1.Value >= 0)
- {
- return;
- }
- var result = e.Result;
- decimal targetValue;
- if (decimal.TryParse(result, out targetValue))
- {
- if (targetValue > 0)
- {
- this.gcNumber1.ValueSign = GrapeCity.Win.Editors.ValueSignControl.Negative;
- }
- }
- }
- }
复制代码 有啥不爽自己微调一下。 |