回复 8楼miyaminn的帖子
你拿这段代码试试看- public partial class Form6 : Form
- {
- private const string Number_Negative_Prefix = "-";
- public Form6()
- {
- InitializeComponent();
- // Initialze the format pattern to "########.##"
- // 我假设你那里用到的输入格式是这个样子的,请根据具体项目微调。
- this.gcNumber1.Fields.SetFields("########.##", "", "", Number_Negative_Prefix, "");
- this.gcNumber1.TextChanging += gcNumber1_TextChanging;
- }
- void gcNumber1_TextChanging(object sender, GrapeCity.Win.Editors.TextChangingEventArgs e)
- {
- var result = e.Result;
- if (string.CompareOrdinal(result, Number_Negative_Prefix) == 0)
- {
- this.gcNumber1.Fields.SignPrefix.NegativePattern = string.Empty;
- this.gcNumber1.Text = string.Empty;
- }
- else
- {
- this.gcNumber1.Fields.SignPrefix.NegativePattern = Number_Negative_Prefix;
- }
- }
- }
复制代码 |