Author: Tomas Rutkauskas
Are there any sources available for a DrawGrid (or kind of) with a bitmap in the
background (wallpaper under the whole grid that isn't scrolled) ? I know i can draw
the bitmap in the OnDrawCell event. But if the grid is scrolled, then the whole
canvas is scrolled (including the background bitmap) and only the new cells are
receiving a draw-message.
Answer:
This should get you started:
1 TExtDrawGrid = class(TDrawGrid)
2 protected3 procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
4 public5 end;
6 7 procedure TExtDrawGrid.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
8 begin9 Canvas.Draw(ClientRect.Left, ClientRect.Top, TheBackgroundBitMap);
10 end;
Setting the DefaultDrawing property to false will prevent the grid from overwriting the back ground with standard cell display. You can decide what gets drawn on top of the background for any given cell. Maybe override the paint method to clean up before the rest gets slapped on top.