Example #1
0
 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();
 }
 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();
 }
 public MaskedTextBoxDesignerActionList(MaskedTextBoxDesigner designer) : base(designer.Component)
 {
     this.maskedTextBox = (MaskedTextBox) designer.Component;
     this.discoverySvc = base.GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService;
     this.uiSvc = base.GetService(typeof(IUIService)) as IUIService;
     this.helpService = base.GetService(typeof(IHelpService)) as IHelpService;
     if (this.discoverySvc != null)
     {
         IUIService uiSvc = this.uiSvc;
     }
 }
Example #4
0
 public MaskedTextBoxDesignerActionList(MaskedTextBoxDesigner designer) : base(designer.Component)
 {
     this.maskedTextBox = (MaskedTextBox)designer.Component;
     this.discoverySvc  = base.GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService;
     this.uiSvc         = base.GetService(typeof(IUIService)) as IUIService;
     this.helpService   = base.GetService(typeof(IHelpService)) as IHelpService;
     if (this.discoverySvc != null)
     {
         IUIService uiSvc = this.uiSvc;
     }
 }
        /// <summary>
        /// Constructor receiving a MaskedTextBox control the action list applies to.  The ITypeDiscoveryService
        /// service provider is used to populate the canned mask list control in the MaskDesignerDialog dialog and
        /// the IUIService provider is used to display the MaskDesignerDialog within VS.
        /// </summary>
        public MaskedTextBoxDesignerActionList(MaskedTextBoxDesigner designer) : base(designer.Component)
        {
            _maskedTextBox = (MaskedTextBox)designer.Component;
            _discoverySvc  = GetService(typeof(ITypeDiscoveryService)) as ITypeDiscoveryService;
            _uiSvc         = GetService(typeof(IUIService)) as IUIService;
            _helpService   = GetService(typeof(IHelpService)) as IHelpService;

            if (_discoverySvc == null || _uiSvc == null)
            {
                Debug.Fail("could not get either ITypeDiscoveryService or IUIService");
            }
        }
        /// <summary>
        /// Constructor receiving a clone of the MaskedTextBox control under design.
        /// </summary>
        public MaskDesignerDialog(MaskedTextBox instance, IHelpService helpService)
        {
            if (instance is null)
            {
                Debug.Fail("Null masked text box, creating default.");
                _maskedTextBox = new MaskedTextBox();
            }
            else
            {
                _maskedTextBox = MaskedTextBoxDesigner.GetDesignMaskedTextBox(instance);
            }

            _helpService = helpService;

            InitializeComponent();

            // Enable Vista Explorer listview style
            DesignerUtils.ApplyListViewThemeStyles(_listViewCannedMasks);

            // Non-designer-handled stuff.
            SuspendLayout();

            _txtBoxMask.Text = _maskedTextBox.Mask;

            // Add default mask descriptors to the mask description list.
            AddDefaultMaskDescriptors(_maskedTextBox.Culture);

            //
            // maskDescriptionHeader
            //
            _maskDescriptionHeader.Text  = SR.MaskDesignerDialogMaskDescription;
            _maskDescriptionHeader.Width = _listViewCannedMasks.Width / 3;
            //
            // dataFormatHeader
            //
            _dataFormatHeader.Text  = SR.MaskDesignerDialogDataFormat;
            _dataFormatHeader.Width = _listViewCannedMasks.Width / 3;
            //
            // validatingTypeHeader
            //
            _validatingTypeHeader.Text  = SR.MaskDesignerDialogValidatingType;
            _validatingTypeHeader.Width = (_listViewCannedMasks.Width / 3) - SystemInformation.VerticalScrollBarWidth - 4;  // so no h-scrollbar.
            ResumeLayout(false);

            HookEvents();
        }
Example #7
0
        private static void maskedTextBox1_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
        {
            MaskedTextBox maskedTextBox = sender as MaskedTextBox;

            maskedTextBox.Tag = MaskedTextBoxDesigner.GetMaskInputRejectedErrorMessage(e);
        }
 private void maskedTextBox_MaskInputRejected(object sender, MaskInputRejectedEventArgs e)
 {
     _errorProvider.SetError(_maskedTextBox, MaskedTextBoxDesigner.GetMaskInputRejectedErrorMessage(e));
 }