Tom_Deprez
(Tom Deprez)
October 12, 2014, 10:31am
1
Hi,
DBPlanner 3.1.0.1
dbDaySource and dbMultiMonthSource (especially).
I'm trying to figure out how to change the background color of the cell (and font), depending on the day, but I seem to not find the event for this. Is it this possible?
I want to color the cells representing a sat and sun in another color. (they should not be inactive, just another color, like can be done in the dbPlannerMonthView.
Am I overlooking something?
Thank,
Tom.
You can use the OnPlannerBkgProp event for this. This is triggered for each cell and allows to set the color for a cell via the ABrush parameter.
Alternatively, you can set the background color for a cell via:
planner.BackgroundColor[column,row]: TColor;
Tom_Deprez
(Tom Deprez)
October 14, 2014, 2:16pm
3
Hi Bruno,
Thanks for your reply. I tried this event, but it didn't work, so I thought it the event was for something else. Anyhow, I'll try again.
Regards,
Tom.
Tom_Deprez
(Tom Deprez)
October 14, 2014, 2:51pm
4
Ok, so it is OnPlannerBkgDraw.
Thanks, Tom.
Tom_Deprez
(Tom Deprez)
October 14, 2014, 2:55pm
5
simple example:
procedure TfraCalendar.dbCalendarPlannerBkgDraw(Sender: TObject;
Canvas: TCanvas; Rect: TRect; Index, Position: Integer);
var
CellColor: TColor;
CellBrush: TBrushStyle;
begin
CellColor := clRed;
CellBrush := Canvas.Brush.Style;
if position= 3 then
PlanUtil.RectHorzEx(Canvas, Rect, CellColor, dbCalendar.Color,
(Sender as TPlanner).GridLineColor, Canvas.Pen.Color, Canvas.Pen.Width,
CellBrush);
end;