コード例 #1
0
        public IPAddressControl()
        {
            BackColor = SystemColors.Window;

            ResetBackColorChanged();

            for (int index = 0; index < _fieldControls.Length; ++index)
            {
                _fieldControls[index] = new FieldControl();

                _fieldControls[index].CedeFocusEvent   += new EventHandler <CedeFocusEventArgs>(this.OnCedeFocus);
                _fieldControls[index].FieldId           = index;
                _fieldControls[index].Name              = "FieldControl" + index.ToString(CultureInfo.InvariantCulture);
                _fieldControls[index].Parent            = this;
                _fieldControls[index].SpecialKeyEvent  += new EventHandler <SpecialKeyEventArgs>(this.OnSpecialKey);
                _fieldControls[index].TextChangedEvent += new EventHandler <TextChangedEventArgs>(this.OnFieldTextChanged);

                Controls.Add(_fieldControls[index]);

                if (index < (NumberOfFields - 1))
                {
                    _dotControls[index] = new DotControl();

                    _dotControls[index].Name   = "DotControl" + index.ToString(CultureInfo.InvariantCulture);
                    _dotControls[index].Parent = this;

                    Controls.Add(_dotControls[index]);
                }
            }

            InitializeComponent();

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.ContainerControl, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.Selectable, true);
            SetStyle(ControlStyles.UserPaint, true);

            _referenceTextBox.AutoSize = true;

            Size     = MinimumSize;
            AutoSize = true;

            DragEnter += new DragEventHandler(IPAddressControl_DragEnter);
            DragDrop  += new DragEventHandler(IPAddressControl_DragDrop);
        }
コード例 #2
0
      public IPAddressControl()
      {
         BackColor = SystemColors.Window;

         ResetBackColorChanged();

         for ( int index = 0; index < _fieldControls.Length; ++index )
         {
            _fieldControls[index] = new FieldControl();

            _fieldControls[index].CedeFocusEvent += new EventHandler<CedeFocusEventArgs>( this.OnCedeFocus );
            _fieldControls[index].FieldId = index;
            _fieldControls[index].Name = "FieldControl" + index.ToString( CultureInfo.InvariantCulture );
            _fieldControls[index].Parent = this;
            _fieldControls[index].SpecialKeyEvent += new EventHandler<SpecialKeyEventArgs>( this.OnSpecialKey );
            _fieldControls[index].TextChangedEvent += new EventHandler<TextChangedEventArgs>( this.OnFieldTextChanged );

            Controls.Add( _fieldControls[index] );

            if ( index < ( NumberOfFields - 1 ) )
            {
               _dotControls[index] = new DotControl();

               _dotControls[index].Name = "DotControl" + index.ToString( CultureInfo.InvariantCulture );
               _dotControls[index].Parent = this;

               Controls.Add( _dotControls[index] );
            }
         }

         InitializeComponent();

         SetStyle( ControlStyles.AllPaintingInWmPaint, true );
         SetStyle( ControlStyles.ContainerControl, true );
         SetStyle( ControlStyles.OptimizedDoubleBuffer, true );
         SetStyle( ControlStyles.ResizeRedraw, true );
         SetStyle( ControlStyles.Selectable, true );
         SetStyle( ControlStyles.UserPaint, true );

         _referenceTextBox.AutoSize = true;

         Size = MinimumSize;
         AutoSize = true;

         DragEnter += new DragEventHandler( IPAddressControl_DragEnter );
         DragDrop += new DragEventHandler( IPAddressControl_DragDrop );
      }