当前位置: 首页>>代码示例>>C#>>正文


C# Forms.MaskedTextBox类代码示例

本文整理汇总了C#中System.Windows.Forms.MaskedTextBox的典型用法代码示例。如果您正苦于以下问题:C# MaskedTextBox类的具体用法?C# MaskedTextBox怎么用?C# MaskedTextBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MaskedTextBox类属于System.Windows.Forms命名空间,在下文中一共展示了MaskedTextBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: validar

 public static bool validar(MaskedTextBox msk)
 {
     if (!msk.MaskFull)
         return false;
     else
         return true;
 }
开发者ID:Rimolo,项目名称:Restaurante,代码行数:7,代码来源:Utilidades.cs

示例2: IsValidMaskDescriptor

 public static bool IsValidMaskDescriptor(MaskDescriptor maskDescriptor, out string validationErrorDescription)
 {
     validationErrorDescription = string.Empty;
     if (maskDescriptor == null)
     {
         validationErrorDescription = System.Design.SR.GetString("MaskDescriptorNull");
         return false;
     }
     if ((string.IsNullOrEmpty(maskDescriptor.Mask) || string.IsNullOrEmpty(maskDescriptor.Name)) || string.IsNullOrEmpty(maskDescriptor.Sample))
     {
         validationErrorDescription = System.Design.SR.GetString("MaskDescriptorNullOrEmptyRequiredProperty");
         return false;
     }
     MaskedTextProvider maskedTextProvider = new MaskedTextProvider(maskDescriptor.Mask, maskDescriptor.Culture);
     MaskedTextBox box = new MaskedTextBox(maskedTextProvider) {
         SkipLiterals = true,
         ResetOnPrompt = true,
         ResetOnSpace = true,
         ValidatingType = maskDescriptor.ValidatingType,
         FormatProvider = maskDescriptor.Culture,
         Culture = maskDescriptor.Culture
     };
     box.TypeValidationCompleted += new TypeValidationEventHandler(MaskDescriptor.maskedTextBox1_TypeValidationCompleted);
     box.MaskInputRejected += new MaskInputRejectedEventHandler(MaskDescriptor.maskedTextBox1_MaskInputRejected);
     box.Text = maskDescriptor.Sample;
     if ((box.Tag == null) && (maskDescriptor.ValidatingType != null))
     {
         box.ValidateText();
     }
     if (box.Tag != null)
     {
         validationErrorDescription = box.Tag.ToString();
     }
     return (validationErrorDescription.Length == 0);
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:35,代码来源:MaskDescriptor.cs

示例3: LibroHandler

 //Constructor
 public LibroHandler(Element.NumericUpDown updwLibro, Element.NumericUpDown updwRenglon, Element.MaskedTextBox txtNroFolio, Element.TextBox txtDescripcion)
 {
     this.updwLibro = updwLibro;
     this.updwRenglon = updwRenglon;
     this.txtNroFolio = txtNroFolio;
     this.txtDescripcion = txtDescripcion;
 }
开发者ID:nahueld,项目名称:CoffeeAndCake,代码行数:8,代码来源:LibroHandler.cs

示例4: DateTimePickerPresentation

        /// <summary>
        /// Initializes a new instance of the 'DateTimePickerPresentation' class.
        /// </summary>
        /// <param name="maskedTextBox">.NET MaskedTextBox reference.</param>
        /// <param name="dateTimePicker">.NET DateTimePicker reference.</param>
        public DateTimePickerPresentation(MaskedTextBox maskedTextBox, DateTimePicker dateTimePicker)
        {
            mMaskedTextBoxIT = maskedTextBox;
            mDateTimePickerIT = dateTimePicker;
            if (mMaskedTextBoxIT != null)
            {
                // Create and configure the ErrorProvider control.
                mErrorProvider = new ErrorProvider();
                mErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;

                // Link MaskedTextBox control events.
                mMaskedTextBoxIT.GotFocus += new EventHandler(HandleMaskedTextBoxITGotFocus);
                mMaskedTextBoxIT.LostFocus += new EventHandler(HandleMaskedTextBoxITLostFocus);
                mMaskedTextBoxIT.TextChanged += new EventHandler(HandleMaskedTextBoxITTextChanged);
                mMaskedTextBoxIT.EnabledChanged += new EventHandler(HandleMaskedTextBoxITEnabledChanged);
                mMaskedTextBoxIT.KeyDown += new KeyEventHandler(HandleMaskedTextBoxITKeyDown);
            }

            if (dateTimePicker != null)
            {
                mDateTimePickerIT.Enter += new System.EventHandler(HandleDateTimePickerITEnter);
                mDateTimePickerIT.KeyUp += new System.Windows.Forms.KeyEventHandler(HandleDateTimePickerITKeyUp);
                mDateTimePickerIT.DropDown += new System.EventHandler(HandleDateTimePickerITDropDown);
                mDateTimePickerIT.CloseUp += new System.EventHandler(HandleDateTimePickerCloseUp);
            }
        }
开发者ID:sgon1853,项目名称:UPM_MDD_Thesis,代码行数:31,代码来源:DateTimePickerPresentation.cs

示例5: GetDesignMaskedTextBox

 internal static MaskedTextBox GetDesignMaskedTextBox(MaskedTextBox mtb)
 {
     MaskedTextBox box = null;
     if (mtb == null)
     {
         box = new MaskedTextBox();
     }
     else
     {
         if (mtb.MaskedTextProvider == null)
         {
             box = new MaskedTextBox {
                 Text = mtb.Text
             };
         }
         else
         {
             box = new MaskedTextBox(mtb.MaskedTextProvider);
         }
         box.ValidatingType = mtb.ValidatingType;
         box.BeepOnError = mtb.BeepOnError;
         box.InsertKeyMode = mtb.InsertKeyMode;
         box.RejectInputOnFirstFailure = mtb.RejectInputOnFirstFailure;
         box.CutCopyMaskFormat = mtb.CutCopyMaskFormat;
         box.Culture = mtb.Culture;
     }
     box.UseSystemPasswordChar = false;
     box.PasswordChar = '\0';
     box.ReadOnly = false;
     box.HidePromptOnLeave = false;
     return box;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:MaskedTextBoxDesigner.cs

示例6: MaskedTextBoxAdv

 /// <summary>
 /// Initializes a new instance of the MaskedTextBoxAdv class.
 /// </summary>
 public MaskedTextBoxAdv()
 {
     this.SetStyle(ControlStyles.Selectable, false);
     _MaskedTextBox = new MaskedTextBoxInternal();
     this.BackColor = SystemColors.Window;
     InitControl();
 }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:10,代码来源:MaskedTextBoxAdv.cs

示例7: InitializeControl

        private void InitializeControl()
        {
            SuspendLayout();
            _maskedTextBox = new MaskedTextBox
                                 {
                                     Mask = "00/00/0000",
                                     Size = new Size(139, 20),
                                     Location = new Point(0, 0),
                                     TabIndex = 0,
                                     ValidatingType = typeof (DateTime),
                                 };

            _dropDownButton = new Button();
            _dropDownButton.Size = new Size(16, 16);
            _dropDownButton.FlatStyle = FlatStyle.Standard;
            _dropDownButton.BackColor = Color.White;
            _dropDownButton.Location = new Point(_maskedTextBox.Width - 20, 1);
            _dropDownButton.BackgroundImage = Strings.calendar_icon;
            _dropDownButton.Click += OnDropDownButtonClick;
            _dropDownButton.Cursor = Cursors.Arrow;
            _maskedTextBox.Controls.Add(_dropDownButton);
            AutoScaleMode=AutoScaleMode.Dpi;
            _maskedTextBox.Text = DateTime.Now.ToString("dd/MM/yyyy");
            Controls.Add(_maskedTextBox);
            ResumeLayout(true);
        }
开发者ID:gitter-badger,项目名称:UROCare,代码行数:26,代码来源:DatePickerControl.cs

示例8: MaskedTextBoxTextEditorDropDown

 public MaskedTextBoxTextEditorDropDown(MaskedTextBox maskedTextBox)
 {
     this.cloneMtb = MaskedTextBoxDesigner.GetDesignMaskedTextBox(maskedTextBox);
     this.errorProvider = new ErrorProvider();
     ((ISupportInitialize) this.errorProvider).BeginInit();
     base.SuspendLayout();
     this.cloneMtb.Dock = DockStyle.Fill;
     this.cloneMtb.TextMaskFormat = MaskFormat.IncludePromptAndLiterals;
     this.cloneMtb.ResetOnPrompt = true;
     this.cloneMtb.SkipLiterals = true;
     this.cloneMtb.ResetOnSpace = true;
     this.cloneMtb.Name = "MaskedTextBoxClone";
     this.cloneMtb.TabIndex = 0;
     this.cloneMtb.MaskInputRejected += new MaskInputRejectedEventHandler(this.maskedTextBox_MaskInputRejected);
     this.cloneMtb.KeyDown += new KeyEventHandler(this.maskedTextBox_KeyDown);
     this.errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;
     this.errorProvider.ContainerControl = this;
     base.Controls.Add(this.cloneMtb);
     this.BackColor = SystemColors.Control;
     base.BorderStyle = BorderStyle.FixedSingle;
     base.Name = "MaskedTextBoxTextEditorDropDown";
     base.Padding = new Padding(0x10);
     base.Size = new Size(100, 0x34);
     ((ISupportInitialize) this.errorProvider).EndInit();
     base.ResumeLayout(false);
     base.PerformLayout();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:MaskedTextBoxTextEditorDropDown.cs

示例9: MaskDesignerDialog

 public MaskDesignerDialog(MaskedTextBox instance, IHelpService helpService)
 {
     if (instance == null)
     {
         this.maskedTextBox = new MaskedTextBox();
     }
     else
     {
         this.maskedTextBox = MaskedTextBoxDesigner.GetDesignMaskedTextBox(instance);
     }
     this.helpService = helpService;
     this.InitializeComponent();
     DesignerUtils.ApplyListViewThemeStyles(this.listViewCannedMasks);
     base.SuspendLayout();
     this.txtBoxMask.Text = this.maskedTextBox.Mask;
     this.AddDefaultMaskDescriptors(this.maskedTextBox.Culture);
     this.maskDescriptionHeader.Text = System.Design.SR.GetString("MaskDesignerDialogMaskDescription");
     this.maskDescriptionHeader.Width = this.listViewCannedMasks.Width / 3;
     this.dataFormatHeader.Text = System.Design.SR.GetString("MaskDesignerDialogDataFormat");
     this.dataFormatHeader.Width = this.listViewCannedMasks.Width / 3;
     this.validatingTypeHeader.Text = System.Design.SR.GetString("MaskDesignerDialogValidatingType");
     this.validatingTypeHeader.Width = ((this.listViewCannedMasks.Width / 3) - SystemInformation.VerticalScrollBarWidth) - 4;
     base.ResumeLayout(false);
     this.HookEvents();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:MaskDesignerDialog.cs

示例10: ParteHandler

        public ParteHandler(Element.ComboBox cboTipoDoc, Element.MaskedTextBox txtNroDni, Element.ComboBox cboSexo,
                            Element.TextBox txtNombre, Element.TextBox txtApellido, Element.MaskedTextBox txtCuit,
                            Element.DateTimePicker dpFecNac, Element.ComboBox cboECivil, Element.TextBox txtDomicilio,
                            Element.ComboBox cboCiudad, Element.ComboBox cboDepartamento, Element.ComboBox cboProvincia,
                            Element.ComboBox cboNacionalidad)
        {
            this.cboTipoDoc = cboTipoDoc;
            this.txtNroDni = txtNroDni;
            this.cboSexo = cboSexo;
            this.txtNombre = txtNombre;
            this.txtApellido = txtApellido;
            this.txtCuit = txtCuit;
            this.dpFecNac = dpFecNac;
            this.cboECivil = cboECivil;
            this.txtDomicilio = txtDomicilio;
            this.cboCiudad = cboCiudad;
            this.cboDepartamento = cboDepartamento;
            this.cboProvincia = cboProvincia;
            this.cboNacionalidad = cboNacionalidad;

            formatoPartes();

            con.Connect();
            ds1 = con.fillDs("SELECT * FROM DOCUMENTOS;", "PARTES");
            ds2 = con.fillDs("SELECT * FROM SEXOS;", "SEXOS");
            ds3 = con.fillDs("SELECT * FROM ESTADOS_CIVILES;", "ESTADOS");
            ds7 = con.fillDs("SELECT * FROM NACIONALIDADES;", "NACIONALIDADES");
            cboTipoDoc.DataSource = ds1.Tables[0];
            cboSexo.DataSource = ds2.Tables[0];
            cboECivil.DataSource = ds3.Tables[0];
            cboNacionalidad.DataSource = ds7.Tables[0];
        }
开发者ID:nahueld,项目名称:CoffeeAndCake,代码行数:32,代码来源:ParteHandler.cs

示例11: EditValue

 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService service = null;
     if (((context != null) && (context.Instance != null)) && (provider != null))
     {
         service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
         if ((service == null) || (context.Instance == null))
         {
             return value;
         }
         MaskedTextBox instance = context.Instance as MaskedTextBox;
         if (instance == null)
         {
             instance = new MaskedTextBox {
                 Text = value as string
             };
         }
         MaskedTextBoxTextEditorDropDown control = new MaskedTextBoxTextEditorDropDown(instance);
         service.DropDownControl(control);
         if (control.Value != null)
         {
             value = control.Value;
         }
     }
     return value;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:MaskedTextBoxTextEditor.cs

示例12: clsGLAcLookUp

 //
 public clsGLAcLookUp( MaskedTextBox pTB, string pTitle,string pJoin = "", string pAddWhere = ""  )
 {
     fTB = pTB;
       fTitle = pTitle;
       fJoin = pJoin;
       fAddWhere = pAddWhere;
 }
开发者ID:naveed02,项目名称:C_Sharp_Practice,代码行数:8,代码来源:clsGLAcLookUp.cs

示例13: VehiculoHandler

        Element.TextBox txtPrefijo; // txt prefijo del vehiculo

        #endregion Fields

        #region Constructors

        public VehiculoHandler(Element.ComboBox cboDesc, Element.ComboBox cboMarca, Element.MaskedTextBox txtDominio, Element.TextBox txtPrefijo)
        {
            this.cboDesc = cboDesc;
            this.cboMarca = cboMarca;
            this.txtDominio = txtDominio;
            this.txtPrefijo = txtPrefijo;
        }
开发者ID:nahueld,项目名称:CoffeeAndCake,代码行数:13,代码来源:VehiculoHandler.cs

示例14: validarMaskedTextBox

 public static bool validarMaskedTextBox(MaskedTextBox unMaskedTextBox, String unMensajeDeAlerta)
 {
     if (unMaskedTextBox.Text.Length < 1)
     {
         MessageBox.Show(unMensajeDeAlerta);
         return false;
     }
     return true;
 }
开发者ID:martinnbasile,项目名称:aerolineaFRBA,代码行数:9,代码来源:Validaciones.cs

示例15: ValidateMaskedTextbox

        public bool ValidateMaskedTextbox(MaskedTextBox test)
        {
            if (test.Text.Length == 0)
            {
                test.BackColor = _invalidColor;
                return false;
            }

            test.BackColor = _validColor;
            return true;
        }
开发者ID:jnnpsubm,项目名称:YAR-Auth,代码行数:11,代码来源:WizardMain.cs


注:本文中的System.Windows.Forms.MaskedTextBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。