Ejemplo n.º 1
0
        /// <summary>
        /// The text bounds don't include the button (if shown).
        /// </summary>
        public override Rectangle GetTextBounds(DataGridCell cell)
        {
            System.Windows.Forms.DataGrid grid = DataGridTableStyle.DataGrid;

            if (ShouldShowButton(GetProperty(DataGrid.GetCurrencyManager(grid), cell.RowNumber), cell))
            {
                Rectangle cellBounds = grid.GetCellBounds(cell);
                return(new Rectangle(cellBounds.X + m_buttonWidth, cellBounds.Y,
                                     cellBounds.Width - m_buttonWidth, cellBounds.Height));
            }
            else
            {
                return(base.GetTextBounds(cell));
            }
        }
Ejemplo n.º 2
0
        public void Initialise()
        {
            // Assign event handlers that allow the edit button to be "clicked".

            System.Windows.Forms.DataGrid grid = DataGridTableStyle.DataGrid;

            grid.MouseUp   += new MouseEventHandler(DataGrid_MouseUp);
            grid.MouseMove += new MouseEventHandler(DataGrid_MouseMove);

            // The MouseUp event actually performs the click - AfterMouseDown just makes the button look pressed,
            // so even if the the DataGrid is not actually an LinkMe.Framework.Tools DataGrid the click will still work.

            DataGrid customDataGrid = grid as DataGrid;

            if (customDataGrid != null)
            {
                customDataGrid.AfterMouseDown += new MouseEventHandler(DataGrid_AfterMouseDown);
            }

            TextBox.KeyDown += new KeyEventHandler(TextBox_KeyDown);
        }
Ejemplo n.º 3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (DataGridTableStyle != null)
                {
                    System.Windows.Forms.DataGrid grid = DataGridTableStyle.DataGrid;

                    if (grid != null)
                    {
                        grid.MouseUp   -= new MouseEventHandler(DataGrid_MouseUp);
                        grid.MouseMove -= new MouseEventHandler(DataGrid_MouseMove);

                        DataGrid customDataGrid = grid as DataGrid;
                        if (customDataGrid != null)
                        {
                            customDataGrid.AfterMouseDown -= new MouseEventHandler(DataGrid_AfterMouseDown);
                        }
                    }
                }
            }

            base.Dispose(disposing);
        }