Exemple #1
0
        public virtual void DrawButton(Graphics paint, Rectangle cellRect, Rectangle buttonRect, string cellValue, ButtonCellStyleInfo style, DataColumnBase column, Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex rowColumnIndex, int buttonIndex = 0)
        {
            // No need to draw the button when its not visible on the cell bounds.
            if (cellRect.Width < 5)
            {
                return;
            }

            var clipBound  = paint.ClipBounds;
            var cellButton = (column.GridColumn as GridTextButtonColumn).CellButton;


            bool drawHovered = false;

            DrawBackground(paint, buttonRect, style, drawHovered, cellButton);

            if (cellRect.Contains(buttonRect))
            {
                paint.SetClip(buttonRect);
            }
            else if (cellRect.IntersectsWith(buttonRect))
            {
                Rectangle intersectRect = Rectangle.Intersect(cellRect, buttonRect);
                paint.SetClip(intersectRect);
            }

            if (cellButton.Image != null)
            {
                var       imageSize      = cellButton.Image.Size.IsEmpty ? cellButton.Image.Size : Size.Empty;
                Rectangle imageRectangle = buttonRect;
                DrawImage(paint, imageRectangle, cellButton.Image);
            }

            paint.SetClip(cellRect);
            DrawBorder(paint, buttonRect, style, drawHovered);
            paint.SetClip(clipBound);
        }
 protected override void OnInitializeEditElement(DataColumnBase column, Syncfusion.WinForms.GridCommon.ScrollAxis.RowColumnIndex rowColumnIndex, TextBox uiElement)
 {
     base.OnInitializeEditElement(column, rowColumnIndex, uiElement);
     uiElement.KeyDown += uiElement_KeyDown;
 }