Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void OnMouseClick(DataGridViewCellMouseEventArgs e)
        {
            if (!IsPointOverButton(e.Location, true) || !ShowButton || IsInEditMode)
            {
                base.OnMouseClick(e);
                return;
            }

            PushButtonColumn col =
                DataGridView.Columns[ColumnIndex] as PushButtonColumn;

            if (col != null)
            {
                col.InvokeButtonClick(e);
            }
        }
Example #2
0
		/// ------------------------------------------------------------------------------------
		private void DrawPlainButton(PushButtonColumn.ButtonType type, Graphics g, Rectangle rcbtn)
		{
			ButtonState state = (_mouseDownOnButton && _mouseOverButton && _enabled ?
				ButtonState.Pushed : ButtonState.Normal);

			if (!_enabled)
				state |= ButtonState.Inactive;

			if (type != PushButtonColumn.ButtonType.PlainCombo)
				ControlPaint.DrawButton(g, rcbtn, state);
			else
			{
				rcbtn = AdjustRectToDefaultComboButtonWidth(rcbtn);
				ControlPaint.DrawComboButton(g, rcbtn, state);
			}
		}
Example #3
0
		/// ------------------------------------------------------------------------------------
		private bool DrawVisualStyledButton(PushButtonColumn.ButtonType buttonStyle,
			IDeviceContext g, Rectangle rcbtn)
		{
			VisualStyleElement element = (buttonStyle == PushButtonColumn.ButtonType.VisualStyleCombo ?
				GetVisualStyleComboButton() : GetVisualStylePushButton());

			if (!BetterGrid.CanPaintVisualStyle(element))
				return false;

			VisualStyleRenderer renderer = new VisualStyleRenderer(element);
			rcbtn = AdjustRectToDefaultComboButtonWidth(rcbtn);
			renderer.DrawBackground(g, rcbtn);
			return true;
		}
Example #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a SilButtonColumn grid column.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public static PushButtonColumn CreatePushButtonColumn(string name)
		{
			var col = new PushButtonColumn(name);
			var templateCell = new PushButtonCell();
			templateCell.Style.Font = SystemFonts.MenuFont;
			templateCell.Style.SelectionForeColor = SystemColors.HighlightText;
			col.CellTemplate = templateCell;
			col.HeaderCell.Style.Font = SystemFonts.MenuFont;
			col.HeaderText = name;

			return col;
		}