Download Now

    Reference TDrawCellEvent

    Declared in Codebot.Render.Widgets.pas on line 1077

    TScrollGrid shows cells in rows and columns, all of the same size. The grid draws nothing in a cell itself. OnDrawCell is called for each cell which can be seen, with the canvas to draw on, the row and column of the cell, and the rectangle of the cell on the canvas. Drawing is clipped to the cell.
    One cell can be selected by clicking it, by dragging over the cells, or with the arrow, Home, End, Prior, and Next keys, and OnChange fires when the selected cell changes. While the mouse is held past an edge of the cells during a drag the grid scrolls on a timer, whether or not the mouse moves.
    The theme draws the grid with the frame and background of a list box. It draws nothing in a cell, not even a box for the selected cell, so that OnDrawCell decides how every cell looks. Selected tells OnDrawCell if a cell is the selected cell, and SelectColor, SelectTextColor, and TextColor are the colors a list box uses, for drawing cells which match one. Lines are drawn between the cells if GridLines is set.
    A vertical or horizontal scroll bar is shown when the cells do not fit. The mouse wheel scrolls the rows, or the columns with Shift held. The grid keeps the size it is given, 300 by 200 by default.
    Every column is ColWidth wide unless it is given a width of its own with ColWidths.
    When HeaderRow is true a header is shown above the cells, with a cell above each column holding the title of the column from ColTitles. The header is not one of the rows, so row 0 is still the first row of cells. It scrolls across with the columns but stays in place as the rows are scrolled, and the vertical scroll bar begins below it. The theme draws the header, and a header cell is drawn hot while the mouse is over it and pressed while the mouse is held down on it. Clicking a header cell fires OnHeaderClick. The grid does not sort. SortCol and SortDescending only tell the theme where to draw the arrow which shows how the rows were sorted.
    When ColSizing is also true a column is resized by dragging the right edge of its header cell, and OnColResize fires as its width changes. HeaderRow and ColSizing are false by default.
    TDrawCellEvent = procedure(Sender: TObject; Surface: ICanvas; Row, Col: Integer; const Rect: TRectF) of object;

    See also

    ICanvas in Codebot.Render.Graphics.pas
    TRectF in Codebot.Graphics.Types.pas