2010. augusztus 21., szombat
How to create a DrawGrid with a non-scrolling background image
Problem/Question/Abstract:
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:
TExtDrawGrid = class(TDrawGrid)
protected
procedure WMEraseBkGnd(var Msg: TWMEraseBkGnd); message WM_ERASEBKGND;
public
end;
procedure TExtDrawGrid.WMEraseBkGnd(var Msg: TWMEraseBkGnd);
begin
Canvas.Draw(ClientRect.Left, ClientRect.Top, TheBackgroundBitMap);
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.
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése