summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-09-11 13:24:45 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-09-11 13:24:45 +0200
commitef921e0b24e374a1e29f870690b346df6d178daf (patch)
tree409525f74d277bad9971bc83d970edbae69a859d /examples
parent822862fb6a875e994b712d443e627e1d904b5eea (diff)
downloadfpGUI-ef921e0b24e374a1e29f870690b346df6d178daf.tar.xz
GridTest: added some more comments and more custom drawing.
Diffstat (limited to 'examples')
-rw-r--r--examples/gui/gridtest/gridtest.lpr14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/gui/gridtest/gridtest.lpr b/examples/gui/gridtest/gridtest.lpr
index fe7de916..b12811bf 100644
--- a/examples/gui/gridtest/gridtest.lpr
+++ b/examples/gui/gridtest/gridtest.lpr
@@ -160,6 +160,20 @@ begin
StringGrid.Canvas.SetTextColor(clTeal);
StringGrid.Canvas.DrawString(ARect.Height + ARect.Left + 2, ARect.Top, StringGrid.Cells[ACol, ARow]);
end;
+ // two rows with different background color
+ if (ARow = 7) or (ARow = 8) then
+ begin
+ if ((gdSelected in AFlags) and (gdFocused in AFlags)) or
+ (gdSelected in AFlags) then
+ Exit; // we want select cel to be painted as normal
+ // If we got here, we must do some painting. The background first.
+ StringGrid.Canvas.Color := clOrange;
+ StringGrid.Canvas.FillRectangle(ARect);
+ // NOTE: We want the grid to take care of the drawing of the text, which
+ // handles text layout and alignment, so we MUST NOT set the
+ // ADefaultDrawing to False. If we do, we need to handle text painting
+ // ourselves.
+ end;
end;
procedure TMainForm.btnTopRowClicked(Sender: TObject);