예제 #1
0
        public UpDownBase()
        {
            _UpDownAlign        = LeftRightAlignment.Right;
            InternalBorderStyle = BorderStyle.None;

            spnSpinner             = new UpDownStepper();
            spnSpinner.Offset      = new Size(-1, -1);
            spnSpinner.UpButton   += (sender, e) => { UpButton(); };
            spnSpinner.DownButton += (sender, e) => { DownButton(); };

            txtView = new UpDownTextBox(this);
            txtView.ModifiedChanged += OnChanged;
            txtView.AcceptsReturn    = true;
            txtView.AutoSize         = false;
            txtView.BorderStyle      = BorderStyle.Fixed3D;
            txtView.TabIndex         = TabIndex;
            txtView.SetStyle(ControlStyles.Selectable, true);

            spnSpinner.Size = spnSpinner.PreferredSize;
            spnSpinner.Dock = DockStyle.Right;

            txtView.Dock = DockStyle.Left;

            SuspendLayout();
            Controls.Add(spnSpinner);
            Controls.Add(txtView);
            ResumeLayout();

            SuspendLayout();
            txtView.Size      = new Size(Width - spnSpinner.Width - 4, txtView.PreferredHeight);
            txtView.Anchor    = AnchorStyles.Left | AnchorStyles.Right;
            spnSpinner.Size   = spnSpinner.PreferredSize;
            spnSpinner.Anchor = AnchorStyles.Right;
            ResumeLayout();

            Height = PreferredHeight;

            TabIndexChanged += TabIndexChangedHandler;

            txtView.KeyDown  += OnTextBoxKeyDown;
            txtView.KeyPress += OnTextBoxKeyPress;
//			txtView.LostFocus += OnTextBoxLostFocus;
            txtView.Resize      += OnTextBoxResize;
            txtView.TextChanged += OnTextBoxTextChanged;

            // So the child controls don't get auto selected when the updown is selected
            auto_select_child = false;
            SetStyle(ControlStyles.FixedHeight | ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility, false);

            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            base.BackColor = Color.Transparent;
        }
예제 #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                txtView.Dispose();
                txtView = null;

                spnSpinner.Dispose();
                spnSpinner = null;
            }
            base.Dispose(disposing);
        }
        public UpDownBase()
        {
            _UpDownAlign        = LeftRightAlignment.Right;
            InternalBorderStyle = BorderStyle.Fixed3D;

            spnSpinner = new UpDownSpinner(this);

            txtView = new UpDownTextBox(this);
            txtView.ModifiedChanged += new EventHandler(OnChanged);
            txtView.AcceptsReturn    = true;
            txtView.AutoSize         = false;
            txtView.BorderStyle      = BorderStyle.None;
            txtView.Location         = new System.Drawing.Point(17, 17);
            txtView.TabIndex         = TabIndex;

            spnSpinner.Width = 16;
            spnSpinner.Dock  = DockStyle.Right;

            txtView.Dock = DockStyle.Fill;

            SuspendLayout();
            Controls.Add(spnSpinner);
            Controls.Add(txtView);
            ResumeLayout();

            SuspendLayout();
            txtView.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
            txtView.Size   = new Size(txtView.Width - spnSpinner.Width, txtView.Height);
            ResumeLayout();

            Height         = PreferredHeight;
            base.BackColor = txtView.BackColor;

            TabIndexChanged += new EventHandler(TabIndexChangedHandler);

            txtView.KeyDown  += new KeyEventHandler(OnTextBoxKeyDown);
            txtView.KeyPress += new KeyPressEventHandler(OnTextBoxKeyPress);
//			txtView.LostFocus += new EventHandler(OnTextBoxLostFocus);
            txtView.Resize      += new EventHandler(OnTextBoxResize);
            txtView.TextChanged += new EventHandler(OnTextBoxTextChanged);

            // So the child controls don't get auto selected when the updown is selected
            auto_select_child = false;
            SetStyle(ControlStyles.FixedHeight, true);
            SetStyle(ControlStyles.Selectable, true);
            SetStyle(ControlStyles.Opaque | ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility, false);
        }
예제 #4
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EmpSearchBlock));
     this.comboBoxEmp = new System.Windows.Forms.ComboBox();
     this.label1      = new System.Windows.Forms.Label();
     this.textEmp     = new UpDownTextBox();
     this.SuspendLayout();
     //
     // comboBoxEmp
     //
     resources.ApplyResources(this.comboBoxEmp, "comboBoxEmp");
     this.comboBoxEmp.DropDownStyle             = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboBoxEmp.Name                      = "comboBoxEmp";
     this.comboBoxEmp.DropDown                 += new System.EventHandler(this.comboBoxEmp_DropDown);
     this.comboBoxEmp.SelectionChangeCommitted += new System.EventHandler(this.comboBoxEmp_SelectionChangeCommitted);
     this.comboBoxEmp.KeyUp                    += new System.Windows.Forms.KeyEventHandler(this.comboBoxEmp_KeyUp);
     this.comboBoxEmp.Leave                    += new System.EventHandler(this.comboBoxEmp_Leave);
     //
     // label1
     //
     resources.ApplyResources(this.label1, "label1");
     this.label1.Name = "label1";
     //
     // textEmp
     //
     resources.ApplyResources(this.textEmp, "textEmp");
     this.textEmp.HideSelection = false;
     this.textEmp.Name          = "textEmp";
     this.textEmp.KeyDown      += new System.Windows.Forms.KeyEventHandler(this.textEmp_KeyDown);
     this.textEmp.KeyUp        += new System.Windows.Forms.KeyEventHandler(this.textEmp_KeyUp);
     this.textEmp.Leave        += new System.EventHandler(this.textEmp_Leave);
     //
     // EmpSearchBlock
     //
     this.BackColor = System.Drawing.SystemColors.Control;
     this.Controls.Add(this.label1);
     this.Controls.Add(this.textEmp);
     this.Controls.Add(this.comboBoxEmp);
     this.DoubleBuffered = true;
     this.Name           = "EmpSearchBlock";
     resources.ApplyResources(this, "$this");
     this.ResumeLayout(false);
     this.PerformLayout();
 }
예제 #5
0
 /// <summary>
 ///   Required method for Designer support - do not modify the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PersonBlock));
     this.buttonSelect  = new System.Windows.Forms.Button();
     this.buttonRemove  = new System.Windows.Forms.Button();
     this.list          = new System.Windows.Forms.ListView();
     this.Column1       = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
     this.person        = new Kesco.Lib.Win.UpDownTextBox();
     this.buttonFindAll = new System.Windows.Forms.Button();
     this.comboPerson   = new System.Windows.Forms.ComboBox();
     this.SuspendLayout();
     //
     // buttonSelect
     //
     resources.ApplyResources(this.buttonSelect, "buttonSelect");
     this.buttonSelect.Name   = "buttonSelect";
     this.buttonSelect.Click += new System.EventHandler(this.buttonSelect_Click);
     //
     // buttonRemove
     //
     resources.ApplyResources(this.buttonRemove, "buttonRemove");
     this.buttonRemove.Name   = "buttonRemove";
     this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click);
     //
     // list
     //
     resources.ApplyResources(this.list, "list");
     this.list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
         this.Column1
     });
     this.list.FullRowSelect    = true;
     this.list.HeaderStyle      = System.Windows.Forms.ColumnHeaderStyle.None;
     this.list.HideSelection    = false;
     this.list.HotTracking      = true;
     this.list.HoverSelection   = true;
     this.list.Name             = "list";
     this.list.ShowItemToolTips = true;
     this.list.UseCompatibleStateImageBehavior = false;
     this.list.View = System.Windows.Forms.View.Details;
     this.list.SelectedIndexChanged += new System.EventHandler(this.list_SelectedIndexChanged);
     this.list.LostFocus            += new System.EventHandler(this.list_FocusLost);
     this.list.MouseDoubleClick     += new System.Windows.Forms.MouseEventHandler(this.list_MouseDoubleClick);
     //
     // Column1
     //
     resources.ApplyResources(this.Column1, "Column1");
     //
     // person
     //
     resources.ApplyResources(this.person, "person");
     this.person.BorderStyle   = System.Windows.Forms.BorderStyle.Fixed3D;
     this.person.HideSelection = false;
     this.person.Name          = "person";
     this.person.KeyDown      += new System.Windows.Forms.KeyEventHandler(this.person_KeyDown);
     this.person.KeyUp        += new System.Windows.Forms.KeyEventHandler(this.person_KeyUp);
     this.person.Leave        += new System.EventHandler(this.person_Leave);
     //
     // buttonFindAll
     //
     resources.ApplyResources(this.buttonFindAll, "buttonFindAll");
     this.buttonFindAll.Name   = "buttonFindAll";
     this.buttonFindAll.Click += new System.EventHandler(this.buttonFindAll_Click);
     //
     // comboPerson
     //
     resources.ApplyResources(this.comboPerson, "comboPerson");
     this.comboPerson.DropDownStyle             = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboPerson.Name                      = "comboPerson";
     this.comboPerson.TabStop                   = false;
     this.comboPerson.DropDown                 += new System.EventHandler(this.comboPerson_DropDown);
     this.comboPerson.SelectionChangeCommitted += new System.EventHandler(this.comboPerson_SelectionChangeCommitted);
     this.comboPerson.KeyDown                  += new System.Windows.Forms.KeyEventHandler(this.comboPerson_KeyDown);
     this.comboPerson.Leave                    += new System.EventHandler(this.comboPerson_Leave);
     //
     // PersonBlock
     //
     this.Controls.Add(this.person);
     this.Controls.Add(this.list);
     this.Controls.Add(this.buttonSelect);
     this.Controls.Add(this.buttonRemove);
     this.Controls.Add(this.buttonFindAll);
     this.Controls.Add(this.comboPerson);
     this.DoubleBuffered = true;
     this.Name           = "PersonBlock";
     resources.ApplyResources(this, "$this");
     this.Load += new System.EventHandler(this.PersonBlock_Load);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
예제 #6
0
        protected override void OnApplyTemplate()
#endif
        {
            base.OnApplyTemplate();

#if UWP
            if (DesignMode.DesignModeEnabled)
            {
                return;
            }
#endif

            this.GotFocus  += this.OnGotFocus;
            this.LostFocus += this.OnLostFocus;
#if UWP
            this.PointerWheelChanged += this.OnPointerWheelChanged;
#endif
            _valueTextBox    = this.GetTemplateChild(ValueTextBoxName) as UpDownTextBox;
            _dragOverlay     = this.GetTemplateChild(DragOverlayName) as UIElement;
            _decrementButton = this.GetTemplateChild(DecrementButtonName) as RepeatButton;
            _incrementButton = this.GetTemplateChild(IncrementButtonName) as RepeatButton;
            _valueBar        = this.GetTemplateChild(ValueBarName) as FrameworkElement;

            if (_valueTextBox != null)
            {
                _valueTextBox.LostFocus += this.OnValueTextBoxLostFocus;
                _valueTextBox.GotFocus  += this.OnValueTextBoxGotFocus;
#if UWP
                _valueTextBox.Text = this.Value.ToString(CultureInfo.CurrentCulture);
#else
                _valueTextBox.Text = this.Value.ToString();
#endif
                _valueTextBox.TextChanged += this.OnValueTextBoxTextChanged;
                _valueTextBox.KeyDown     += this.OnValueTextBoxKeyDown;
                _valueTextBox.UpPressed   += (s, e) => this.DoIncrement();
                _valueTextBox.DownPressed += (s, e) => this.DoDecrement();
#if UWP
                _valueTextBox.PointerExited += this.OnValueTextBoxPointerExited;
#endif
            }

            if (_dragOverlay != null)
            {
#if UWP
                _dragOverlay.Tapped          += this.OnDragOverlayTapped;
                _dragOverlay.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY;
#endif
#if MIGRATION
                _dragOverlay.MouseLeftButtonDown += this.OnDragOverlayPointerPressed;
                _dragOverlay.MouseLeftButtonUp   += this.OnDragOverlayPointerReleased;
                _dragOverlay.LostMouseCapture    += this.OnDragOverlayPointerCaptureLost;
#else
                _dragOverlay.PointerPressed     += this.OnDragOverlayPointerPressed;
                _dragOverlay.PointerReleased    += this.OnDragOverlayPointerReleased;
                _dragOverlay.PointerCaptureLost += this.OnDragOverlayPointerCaptureLost;
#endif
            }

            if (_decrementButton != null)
            {
                _decrementButton.Click += this.OnDecrementButtonClick;
#if UWP
                var pcc =
                    new PropertyChangeEventSource <bool>
                        (_decrementButton, "IsPressed");
                pcc.ValueChanged += this.OnDecrementButtonIsPressedChanged;
#endif
            }

            if (_incrementButton != null)
            {
                _incrementButton.Click += this.OnIncrementButtonClick;
#if UWP
                var pcc =
                    new PropertyChangeEventSource <bool>
                        (_incrementButton, "IsPressed");
                pcc.ValueChanged += this.OnIncrementButtonIsPressedChanged;
#endif
            }

            if (_valueBar != null)
            {
                _valueBar.SizeChanged += this.OnValueBarSizeChanged;

                this.UpdateValueBar();
            }

            this.UpdateIsReadOnlyDependants();
            this.SetValidIncrementDirection();
        }
예제 #7
0
		protected override void Dispose (bool disposing)
		{
			if (disposing) {
				txtView.Dispose();
				txtView = null;

				spnSpinner.Dispose();
				spnSpinner = null;
			}
			base.Dispose (disposing);
		}
예제 #8
0
		public UpDownBase()
		{
			_UpDownAlign = LeftRightAlignment.Right;
			InternalBorderStyle = BorderStyle.Fixed3D;

			spnSpinner = new UpDownSpinner(this);

			txtView = new UpDownTextBox (this);
			txtView.ModifiedChanged += new EventHandler(OnChanged);
			txtView.AcceptsReturn = true;
			txtView.AutoSize = false;
			txtView.BorderStyle = BorderStyle.None;
			txtView.Location = new System.Drawing.Point(17, 17);
			txtView.TabIndex = TabIndex;

			spnSpinner.Width = 16;
			spnSpinner.Dock = DockStyle.Right;
			
			txtView.Dock = DockStyle.Fill;
			
			SuspendLayout ();
			Controls.Add (txtView);
			Controls.Add (spnSpinner);
			ResumeLayout ();

			Height = PreferredHeight;
			base.BackColor = txtView.BackColor;

			TabIndexChanged += new EventHandler (TabIndexChangedHandler);
			
			txtView.KeyDown += new KeyEventHandler(OnTextBoxKeyDown);
			txtView.KeyPress += new KeyPressEventHandler(OnTextBoxKeyPress);
//			txtView.LostFocus += new EventHandler(OnTextBoxLostFocus);
			txtView.Resize += new EventHandler(OnTextBoxResize);
			txtView.TextChanged += new EventHandler(OnTextBoxTextChanged);

			// So the child controls don't get auto selected when the updown is selected
			auto_select_child = false;
			SetStyle(ControlStyles.FixedHeight, true);
			SetStyle(ControlStyles.Selectable, true);
#if NET_2_0
			SetStyle (ControlStyles.Opaque | ControlStyles.ResizeRedraw, true);
			SetStyle (ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility, false);
#endif
		}