GcMaskCell控件的format问题
GcMaskCell控件怎么设置format了,我想将它设置为YY/MM/DD的格式,/一直在固定的位置显示。默认效果为:,输入数据后:
GrapeCity.Win.MultiRow.InputMan.MaskPatternField maskPatternField1 = new GrapeCity.Win.MultiRow.InputMan.MaskPatternField();
GrapeCity.Win.MultiRow.InputMan.MaskLiteralField maskLiteralField1 = new GrapeCity.Win.MultiRow.InputMan.MaskLiteralField();
GrapeCity.Win.MultiRow.InputMan.MaskPatternField maskPatternField2 = new GrapeCity.Win.MultiRow.InputMan.MaskPatternField();
this.columnHeaderSection1 = new GrapeCity.Win.MultiRow.ColumnHeaderSection();
this.gcMaskCell1 = new GrapeCity.Win.MultiRow.InputMan.GcMaskCell(false);
//
// Row
//
this.Row.Cells.Add(this.gcMaskCell1);
this.Row.Height = 252;
this.Row.Width = 681;
//
// columnHeaderSection1
//
this.columnHeaderSection1.Height = 40;
this.columnHeaderSection1.Name = "columnHeaderSection1";
this.columnHeaderSection1.Width = 681;
//
// gcMaskCell1
//
maskPatternField1.MaxLength = 2;
maskPatternField1.MinLength = 2;
maskPatternField1.Pattern = "\\D";
maskLiteralField1.Text = "-";
maskPatternField2.MaxLength = 2;
maskPatternField2.MinLength = 2;
maskPatternField2.Pattern = "\\D";
this.gcMaskCell1.Fields.Add(maskPatternField1);
this.gcMaskCell1.Fields.Add(maskLiteralField1);
this.gcMaskCell1.Fields.Add(maskPatternField2);
this.gcMaskCell1.Location = new System.Drawing.Point(89, 42);
this.gcMaskCell1.Name = "gcMaskCell1";
this.gcMaskCell1.ShortcutKeys.AddRange(new GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry[] {
new GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry(System.Windows.Forms.Keys.F2, "ShortcutClear"),
new GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry(((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Return))), "ApplyRecommendedValue")});
this.gcMaskCell1.Size = new System.Drawing.Size(170, 30);
this.gcMaskCell1.TabIndex = 0;
//
// Template1
//
this.ColumnHeaders.AddRange(new GrapeCity.Win.MultiRow.ColumnHeaderSection[] {
this.columnHeaderSection1});
this.Height = 292;
maskPatternField2.MaxLength = 2;
maskPatternField2.MinLength = 2;
把这两个属性设置成一样的
Richard.Ma 发表于 2021-6-22 18:26
maskPatternField2.MaxLength = 2;
maskPatternField2.MinLength = 2;
样式是可以设置成功的,但是无法输入内容,我希望可以做成可以自由输入的。 本帖最后由 Richard.Ma 于 2021-6-23 12:23 编辑
你说的自由输入具体是怎样的。这里的动图可以看到是可以输入内容的
我的实际跑出来的效果是这样的,不能输入内容,下边是这个控件的代码。
MaskPatternField1.MaxLength = 2
MaskPatternField1.MinLength = 2
MaskPatternField1.Pattern = "\\D"
MaskLiteralField1.Text = "-"
MaskPatternField2.MaxLength = 2
MaskPatternField2.MinLength = 2
MaskPatternField2.Pattern = "\\D"
Me.決済日.Fields.Add(MaskPatternField1)
Me.決済日.Fields.Add(MaskLiteralField1)
Me.決済日.Fields.Add(MaskPatternField2)
Me.決済日.Location = New System.Drawing.Point(724, 20)
Me.決済日.Name = "決済日"
Me.決済日.ShortcutKeys.AddRange(New GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry() {New GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry(System.Windows.Forms.Keys.F2, "ShortcutClear"), New GrapeCity.Win.MultiRow.InputMan.ShortcutDictionaryEntry(CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.), System.Windows.Forms.Keys), "ApplyRecommendedValue")})
Me.決済日.Size = New System.Drawing.Size(89, 20)
CellStyle21.BackColor = System.Drawing.Color.LightYellow
Border22.Bottom = New GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Thin, System.Drawing.Color.Black)
Border22.Left = New GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Thin, System.Drawing.Color.LightGray)
Border22.Right = New GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Thin, System.Drawing.Color.LightGray)
Border22.Top = New GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Thin, System.Drawing.Color.LightGray)
CellStyle21.Border = Border22
CellStyle21.DisabledForeColor = System.Drawing.SystemColors.GrayText
CellStyle21.Font = New System.Drawing.Font("MS ゴシック", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
CellStyle21.ForeColor = System.Drawing.SystemColors.WindowText
CellStyle21.ImeMode = System.Windows.Forms.ImeMode.NoControl
CellStyle21.ImeSentenceMode = GrapeCity.Win.MultiRow.ImeSentenceMode.Normal
CellStyle21.TextAlign = GrapeCity.Win.MultiRow.MultiRowContentAlignment.MiddleCenter
CellStyle21.TextEffect = GrapeCity.Win.MultiRow.TextEffect.Flat
Me.決済日.Style = CellStyle21
Me.決済日.TabIndex = 8
Me.決済日.Value = "210101" 方便的话,最好可以提供一个重现问题的demo,我们可以直接在此基础上进行验证,可能会更快一些 这个已经解决了,感谢您的帮助。:loveliness: 不客气
页:
[1]