Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Ability to change Selected/SelectedInactive cell brush

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Ability to change Selected/SelectedInactive cell brush
Link Posted: 14-May-2006 10:09
thx, that works. What about the 2 other problems?
Link Posted: 15-May-2006 11:16
If you about these problems:

Also, when I have a selected cell and click on another one, the borders don't draw correct again and I want to get rid of the back color for the previously selected cell. How do I do that?



Also, there's another weird bug. When I click on a cell that is editable, a rect is drawn in the upper left corner of the grid on top of the column headers for a short period of time.

EDIT: Actually, this doesn't happen only with editable cells but whenever I click on the top left cell. Then a rect is drawn above the column headers


Probably you've used incorrect rectangle to draw, a sample provided will help to solve this problem. I've tried to emulate this problem on Spreadsheet sample, but have no these problems.
Link Posted: 23-May-2006 09:21
To follow up on this, using this code:

        virtual public void OnEndPaint(CellDrawInfo info)
        {
            if (allowCellSelect)
            {
                Columns cols = info.grid.Columns;
                if (this.Selected && cols.CurrentColumn == info.col)
                {
                    using (Pen pen = new Pen(Color.Yellow, 1))
                    {
                        Rectangle cell = info.cellRect;
                        if ((info.grid.FlyGrid.Options & GridOptions.ShowHorzLines) != 0)
                        {
                            cell.Height -= info.grid.FlyGrid.LineWidth;
                        }
                        if ((info.grid.FlyGrid.Options & GridOptions.ShowVertLines) != 0)
                        {
                            cell.Width -= info.grid.FlyGrid.LineWidth;
                        }
                        Console.WriteLine(cell.ToString());
                        info.g.DrawRectangle(pen, cell);
                    }
                }
            }

            //clear custom info
            info.customForeColor = Color.Empty;
            info.customBackColor = Color.Empty;
            info.Font = null;
        }


The output is:
{X=0,Y=0,Width=74,Height=13}
{X=0,Y=0,Width=74,Height=13}
{X=21,Y=19,Width=26,Height=13}
{X=21,Y=19,Width=26,Height=13}

When I select any cell in the first column this rectangle that shows up above the column headers is drawn. Looking at the output, that's no wonder because it draws it here: {X=0,Y=0,Width=74,Height=13}
... the question is .. why is it drawing a rect at that position at all??
Link Posted: 23-May-2006 13:07

{X=0,Y=0,Width=74,Height=13}
{X=0,Y=0,Width=74,Height=13}
{X=21,Y=19,Width=26,Height=13}
{X=21,Y=19,Width=26,Height=13}


But this is normal rectangles for drawing to FlyGrid.Net client area.


why is it drawing a rect at that position at all??

{X=0,Y=0,Width=74,Height=13} - This is rectangle of first cell in FlyGrid.Net client coordinates.
Link Posted: 23-May-2006 13:27
That's not true. {X=0,Y=0,Width=74,Height=13} specifies the top left of the grid and not the first cell. Because, if I filter X=0, Y=0 this flicker in the top left above the column headers is gone.
Link Posted: 26-May-2006 12:01
This problem is solved.
Nearest update of FlyGrid.Net - beginning of next week.
Link Posted: 12-Jun-2006 09:44
Victor,

this problem still exists when a cell is manually edited and enter is hit to commit the cell value. If I do that a rect is painted at {X=0,Y=0,Width=74,Height=13}.

Thanks,

Tom
Link Posted: 12-Jun-2006 11:02
Did you tried it with v1.4.0.9?
Link Posted: 12-Jun-2006 11:05
yes, it's fixed for clicking on cells which I reported earlier in this thread but it still  happens when I edit a cell value and commit it.
Link Posted: 12-Jun-2006 11:25
Try to insert debug output to OnBeginPaint and OnEndPaint to determine start  info.cellRect in OnBeginPaint and compare with info.cellRect in OnEndPaint.
I've tried to reproduce this problem on Spreadsheet sample, but I receive correct rectangle (with Y starting from 26). Perhaps info.cellRect modified in your custom drawing procedures - in Stylist or elsewhere.