Example #1
0
        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public override void OnPaintCell(I3PaintCellEventArgs e)
        {
            if (e.Table.ColumnModel.Columns[e.Column] is I3NumberColumn)
            {
                I3NumberColumn column = (I3NumberColumn)e.Table.ColumnModel.Columns[e.Column];

                this.ShowUpDownButtons = column.ShowUpDownButtons;
                this.UpDownAlign       = column.UpDownAlign;
                //this.Maximum = Convert.ToDecimal(column.Maximum);
                //this.Minimum = Convert.ToDecimal(column.Minimum);

                // if the table is editing this cell and the editor is a
                // NumberCellEditor then we should display the updown buttons
                if (e.Table.IsEditing && e.Table.EditingCell == e.CellPos && e.Table.EditingCellEditor is I3NumberCellEditor)
                {
                    this.ShowUpDownButtons = true;
                }
            }
            else
            {
                this.ShowUpDownButtons = false;
                this.UpDownAlign       = LeftRightAlignment.Right;
                //this.Maximum = 100;
                //this.Minimum = 0;
            }

            base.OnPaintCell(e);
        }
Example #2
0
        public void SystemInformation_PopupMenuAlignment_Get_ReturnsExpected()
        {
            LeftRightAlignment alignment = SystemInformation.PopupMenuAlignment;

            Assert.True(Enum.IsDefined(typeof(LeftRightAlignment), alignment));
            Assert.Equal(alignment, SystemInformation.PopupMenuAlignment);
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the NumberCellRenderer class with
 /// default settings
 /// </summary>
 public NumberCellRenderer() : base()
 {
     this.StringFormat.Trimming = StringTrimming.None;
     this.Format            = "G";
     this.buttonWidth       = 15;
     this.showUpDownButtons = false;
     this.upDownAlignment   = LeftRightAlignment.Right;
     this.maximum           = (decimal)100;
     this.minimum           = (decimal)0;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the NumberCellRenderer class with
 /// default settings
 /// </summary>
 public DoubleCellRenderer()
 {
     this.StringFormat.Trimming = StringTrimming.None;
     this.Format            = "G";
     this.buttonWidth       = 15;
     this.showUpDownButtons = false;
     this.upDownAlignment   = LeftRightAlignment.Right;
     this.maximum           = 100;
     this.minimum           = 0;
 }
Example #5
0
        /// <summary>
        /// Initializes the NumberColumn with default values
        /// </summary>
        private void Init()
        {
            this.Format = "G";

            this.maximum   = (decimal)100;
            this.minimum   = (decimal)0;
            this.increment = (decimal)1;

            this.showUpDownButtons = false;
            this.upDownAlignment   = LeftRightAlignment.Right;
        }
Example #6
0
 public void Show(Control control, Point pos, LeftRightAlignment alignment)
 {
     if (alignment == LeftRightAlignment.Left)
     {
         this.Show(control, pos, 0x4a);
     }
     else
     {
         this.Show(control, pos, 0x42);
     }
 }
Example #7
0
 /// <include file='doc\ContextMenu.uex' path='docs/doc[@for="ContextMenu.Show2"]/*' />
 /// <devdoc>
 ///     Displays the context menu at the specified position.  This method
 ///     doesn't return until the menu is dismissed.
 /// </devdoc>
 public void Show(Control control, Point pos, LeftRightAlignment alignment)
 {
     // This code below looks wrong but it's correct.
     // WinForms Left alignment means we want the menu to show up left of the point it is invoked from.
     // We specify TPM_RIGHTALIGN which tells win32 to align the right side of this
     // menu with the point (which aligns it Left visually)
     if (alignment == LeftRightAlignment.Left)
     {
         Show(control, pos, NativeMethods.TPM_VERTICAL | NativeMethods.TPM_RIGHTBUTTON | NativeMethods.TPM_RIGHTALIGN);
     }
     else
     {
         Show(control, pos, NativeMethods.TPM_VERTICAL | NativeMethods.TPM_RIGHTBUTTON | NativeMethods.TPM_LEFTALIGN);
     }
 }
        public void Show(Control control, Point pos, LeftRightAlignment alignment)
        {
            Point point;

            if (alignment == LeftRightAlignment.Left)
            {
                point = new Point((pos.X - control.Width), pos.Y);
            }
            else
            {
                point = pos;
            }

            Show(control, point);
        }
Example #9
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
        }
        private void PositionControls()
        {
            Rectangle empty                  = Rectangle.Empty;
            Rectangle rectangle2             = Rectangle.Empty;
            Rectangle rectangle3             = new Rectangle(Point.Empty, base.ClientSize);
            int       width                  = rectangle3.Width;
            bool      renderWithVisualStyles = Application.RenderWithVisualStyles;

            System.Windows.Forms.BorderStyle borderStyle = this.BorderStyle;
            int num2 = (borderStyle == System.Windows.Forms.BorderStyle.None) ? 0 : 2;

            rectangle3.Inflate(-num2, -num2);
            if (this.upDownEdit != null)
            {
                empty      = rectangle3;
                empty.Size = new Size(rectangle3.Width - 0x10, rectangle3.Height);
            }
            if (this.upDownButtons != null)
            {
                int num3 = renderWithVisualStyles ? 1 : 2;
                if (borderStyle == System.Windows.Forms.BorderStyle.None)
                {
                    num3 = 0;
                }
                rectangle2 = new Rectangle((rectangle3.Right - 0x10) + num3, rectangle3.Top - num3, 0x10, rectangle3.Height + (num3 * 2));
            }
            LeftRightAlignment upDownAlign = this.UpDownAlign;

            if (base.RtlTranslateLeftRight(upDownAlign) == LeftRightAlignment.Left)
            {
                rectangle2.X = width - rectangle2.Right;
                empty.X      = width - empty.Right;
            }
            if (this.upDownEdit != null)
            {
                this.upDownEdit.Bounds = empty;
            }
            if (this.upDownButtons != null)
            {
                this.upDownButtons.Bounds = rectangle2;
                this.upDownButtons.Invalidate();
            }
        }
Example #11
0
        public void ContextMenu_Show_InvokeControlPointLeftRightAlignment_Success(LeftRightAlignment alignment)
        {
            using var menu = new ContextMenu();
            var control = new Control
            {
                Visible = true
            };
            int          callCount = 0;
            EventHandler handler   = (sender, e) =>
            {
                Assert.Equal(menu, sender);
                callCount++;
            };

            menu.Popup += handler;

            Assert.NotEqual(IntPtr.Zero, control.Handle);
            menu.Show(control, new Point(1, 2), alignment);
            Assert.Equal(1, callCount);
            Assert.Same(control, menu.SourceControl);
        }
Example #12
0
 public UpDownBase() : base()
 {
     textAlignment            = HorizontalAlignment.Left;
     base.BorderStyleInternal = DefaultBorderStyle;
     upDownEdit              = new UpDownEdit(this);
     upDownEdit.AutoSize     = true;
     upDownEdit.ReadOnly     = false;
     upDownEdit.BorderStyle  = BorderStyle.None;
     upDownEdit.KeyDown     += new KeyEventHandler(OnTextBoxKeyDown);
     upDownEdit.KeyPress    += new KeyPressEventHandler(OnTextBoxKeyPress);
     upDownEdit.LostFocus   += new EventHandler(OnTextBoxLostFocus);
     upDownEdit.Resize      += new EventHandler(OnTextBoxResize);
     upDownEdit.TextChanged += new EventHandler(OnTextBoxTextChanged);
     upDownButtons           = new UpDownButtons(this);
     upDownButtons.TabStop   = false;
     upDownButtons.UpDown   += new UpDownEventHandler(upDownButtons_UpDown);
     upDownAlign             = LeftRightAlignment.Right;
     interceptArrowKeys      = true;
     base.Size = ClientToBounds(new Size(upDownEdit.Width + DefaultButtonsWidth, upDownEdit.Height));
     Controls.AddRange(new Control[] { upDownButtons, upDownEdit });
 }
Example #13
0
        private void PositionControls()
        {
            Size clientSize = base.ClientSize;
            LeftRightAlignment upDownAlign = base.UpDownAlign;

            if (this.upDownEdit != null)
            {
                this.upDownEdit.Size = new Size(clientSize.Width - (16 + this.mButtonWidth + 1), clientSize.Height);
                if (upDownAlign == LeftRightAlignment.Left)
                {
                    this.upDownEdit.Location = new Point(16, 0);
                }
                else
                {
                    this.upDownEdit.Location = new Point(0, 0);
                }
            }
            if (this.upDownButtons != null)
            {
                if (upDownAlign == LeftRightAlignment.Left)
                {
                    this.upDownButtons.Location = new Point(0, 0);
                }
                else
                {
                    this.upDownButtons.Location = new Point(clientSize.Width - (16 + this.mButtonWidth), 0);
                }
            }
            if (this.upDownButtons != null)
            {
                Size size = this.upDownButtons.Size;
                this.upDownButtons.Size = new Size(size.Width, clientSize.Height);
                this.upDownButtons.Invalidate();
                if (this.mButtonWidth > 0)
                {
                    this.degButton.Location = new Point(clientSize.Width - this.degButton.Width, 0);
                }
            }
        }
Example #14
0
        /// <summary>
        /// Initializes the NumberColumn with default values
        /// </summary>
        private void Init()
        {
            this.Format = "G";

            this.maximum = (decimal) 100;
            this.minimum = (decimal) 0;
            this.increment = (decimal) 1;

            this.showUpDownButtons = false;
            this.upDownAlignment = LeftRightAlignment.Right;
        }
Example #15
0
			public LeftRightAlignment PublicRtlTranslateLeftRight (LeftRightAlignment align) { return base.RtlTranslateLeftRight (align); }
Example #16
0
	protected LeftRightAlignment RtlTranslateAlignment
		(LeftRightAlignment align)
			{
				if(RightToLeft == RightToLeft.No)
				{
					return align;
				}
				else if(align == LeftRightAlignment.Left)
				{
					return LeftRightAlignment.Right;
				}
				else
				{
					return LeftRightAlignment.Left;
				}
			}
 public void Show(Control control, Point pos, LeftRightAlignment alignment)
 {
     if (alignment == LeftRightAlignment.Left)
     {
         this.Show(control, pos, 0x4a);
     }
     else
     {
         this.Show(control, pos, 0x42);
     }
 }
	public UpDownBase() : base()
	{
		textAlignment = HorizontalAlignment.Left;
		base.BorderStyleInternal = DefaultBorderStyle;
		upDownEdit = new UpDownEdit(this);
		upDownEdit.AutoSize = true;
		upDownEdit.ReadOnly = false;
		upDownEdit.BorderStyle = BorderStyle.None;
		upDownEdit.KeyDown += new KeyEventHandler(OnTextBoxKeyDown);
		upDownEdit.KeyPress += new KeyPressEventHandler(OnTextBoxKeyPress);
		upDownEdit.LostFocus += new EventHandler(OnTextBoxLostFocus);
		upDownEdit.Resize += new EventHandler(OnTextBoxResize);
		upDownEdit.TextChanged += new EventHandler(OnTextBoxTextChanged);
		upDownButtons = new UpDownButtons(this);
		upDownButtons.TabStop = false;
		upDownButtons.UpDown += new UpDownEventHandler(upDownButtons_UpDown);
		upDownAlign = LeftRightAlignment.Right;
		interceptArrowKeys = true;
		base.Size = ClientToBounds(new Size(upDownEdit.Width + DefaultButtonsWidth, upDownEdit.Height));
		Controls.AddRange(new Control[] {upDownButtons, upDownEdit});
	}
		/// <summary>
		/// Initializes a new instance of the NumberCellRenderer class with 
		/// default settings
		/// </summary>
		public NumberCellRenderer() : base()
		{
			this.StringFormat.Trimming = StringTrimming.None;
			this.Format = "G";
			this.buttonWidth = 15;
			this.showUpDownButtons = false;
			this.upDownAlignment = LeftRightAlignment.Right;
			this.maximum = (decimal) 100;
			this.minimum = (decimal) 0;
		}
Example #20
0
		protected LeftRightAlignment RtlTranslateAlignment(LeftRightAlignment align) {
			if (right_to_left == RightToLeft.No) {
				return align;
			}

			if (align == LeftRightAlignment.Left) {
				return LeftRightAlignment.Right;
			}

			// align must be LeftRightAlignment.Right;
			return LeftRightAlignment.Left;
		}
		// only public constructor
		public DateTimePicker () {
		
			// initialise the month calendar
			month_calendar = new MonthCalendar (this);
			month_calendar.CalendarDimensions = new Size (1, 1);
			month_calendar.MaxSelectionCount = 1;
			month_calendar.ForeColor = Control.DefaultForeColor;
			month_calendar.BackColor = DefaultMonthBackColor;
			month_calendar.TitleBackColor = DefaultTitleBackColor;
			month_calendar.TitleForeColor = DefaultTitleForeColor;
			month_calendar.TrailingForeColor = DefaultTrailingForeColor;
			month_calendar.Visible = false;
			// initialize the timer
			updown_timer = new Timer();
			updown_timer.Interval = initial_timer_delay;

			
			// initialise other variables
			is_checked = true;
			custom_format = null;
			drop_down_align = LeftRightAlignment.Left;
			format = DateTimePickerFormat.Long;
			max_date = MaxDateTime;
			min_date = MinDateTime;
			show_check_box = false;
			show_up_down = false;
			date_value = DateTime.Now;
						
			is_drop_down_visible = false;
			BackColor = SystemColors.Window;
			ForeColor = SystemColors.WindowText;
			
			month_calendar.DateChanged += new DateRangeEventHandler (MonthCalendarDateChangedHandler);
			month_calendar.DateSelected += new DateRangeEventHandler (MonthCalendarDateSelectedHandler);
			month_calendar.LostFocus += new EventHandler (MonthCalendarLostFocusHandler);
			updown_timer.Tick += new EventHandler (UpDownTimerTick);
			KeyPress += new KeyPressEventHandler (KeyPressHandler);
			KeyDown += new KeyEventHandler (KeyDownHandler);
			GotFocus += new EventHandler (GotFocusHandler);
			LostFocus += new EventHandler (LostFocusHandler);
			MouseDown += new MouseEventHandler (MouseDownHandler);			
			MouseUp += new MouseEventHandler (MouseUpHandler);
			MouseEnter += new EventHandler (OnMouseEnter);
			MouseLeave += new EventHandler (OnMouseLeave);
			MouseMove += new MouseEventHandler (OnMouseMove);
			Paint += new PaintEventHandler (PaintHandler);
			Resize += new EventHandler (ResizeHandler);
			SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick, false);
			SetStyle (ControlStyles.FixedHeight, true);
			SetStyle (ControlStyles.Selectable, true);

			CalculateFormats ();
		}
Example #22
0
		protected LeftRightAlignment RtlTranslateLeftRight(LeftRightAlignment align) {
			return RtlTranslateAlignment(align);
		}
Example #23
0
        /// <include file='doc\ContextMenu.uex' path='docs/doc[@for="ContextMenu.Show2"]/*' />
        /// <devdoc>
        ///     Displays the context menu at the specified position.  This method
        ///     doesn't return until the menu is dismissed.
        /// </devdoc>
        public void Show(Control control, Point pos, LeftRightAlignment alignment)  {

            // This code below looks wrong but it's correct. 
            // [....] Left alignment means we want the menu to show up left of the point it is invoked from.
            // We specify TPM_RIGHTALIGN which tells win32 to align the right side of this 
            // menu with the point (which aligns it Left visually)
            if (alignment == LeftRightAlignment.Left) {
                Show(control, pos, NativeMethods.TPM_VERTICAL | NativeMethods.TPM_RIGHTBUTTON | NativeMethods.TPM_RIGHTALIGN);
            }
            else {
                Show(control, pos, NativeMethods.TPM_VERTICAL | NativeMethods.TPM_RIGHTBUTTON | NativeMethods.TPM_LEFTALIGN);
            }
        }
Example #24
0
 public void Show(Control control, Point pos, LeftRightAlignment alignment)
 {
     throw null;
 }
 public void Show(Control control, System.Drawing.Point pos, LeftRightAlignment alignment)
 {
 }
Example #26
0
        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public override void OnPaintCell(PaintCellEventArgs e)
        {
            if (e.Table.ColumnModel.Columns[e.Column] is NumberColumn)
            {
                NumberColumn column = (NumberColumn) e.Table.ColumnModel.Columns[e.Column];

                this.ShowUpDownButtons = column.ShowUpDownButtons;
                this.UpDownAlign = column.UpDownAlign;
                this.Maximum = column.Maximum;
                this.Minimum = column.Minimum;

                // if the table is editing this cell and the editor is a
                // NumberCellEditor then we should display the updown buttons
                if (e.Table.IsEditing && e.Table.EditingCell == e.CellPos && e.Table.EditingCellEditor is NumberCellEditor)
                {
                    this.ShowUpDownButtons = true;
                }
            }
            else
            {
                this.ShowUpDownButtons = false;
                this.UpDownAlign = LeftRightAlignment.Right;
                this.Maximum = 100;
                this.Minimum = 0;
            }

            base.OnPaintCell(e);
        }
		public void Show (Control control, Point pos, LeftRightAlignment alignment)
		{
			Point point;
			
			if (alignment == LeftRightAlignment.Left)
				point = new Point ((pos.X - control.Width), pos.Y);
			else
				point = pos;

			Show (control, point);
		}
		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
		}
Example #29
0
 public LeftRightAlignment PublicRtlTranslateLeftRight(LeftRightAlignment align)
 {
     return(base.RtlTranslateLeftRight(align));
 }
	public void Show(Control control, System.Drawing.Point pos, LeftRightAlignment alignment) {}