In TcxDateNavigator
, is it possible to mark the weekend (Saturday, Sunday) with a diffrent text color (red)?
TMS has this feature implemented but I can't seem to find that in this DevExpress component.
As for the cxDateNavigator
, you can use its OnCustomDrawDayNumber
event handler, for instance, as follows:
uses
DateUtils, cxDateUtils;
procedure TForm60.cxDateNavigator1CustomDrawDayNumber(Sender: TObject; ACanvas: TcxCanvas; AViewInfo: TcxSchedulerDateNavigatorDayNumberViewInfo; var ADone: Boolean);
begin
if DayOfTheWeek(AViewInfo.Date) in [DaySaturday, DaySunday] then
begin
AViewInfo.Bold := True;
ACanvas.Font.Color := clGreen;
ACanvas.Brush.Color := clYellow;
end;
end;
I would not recommend you to use red for weekends, because it usally indicates a holiday.
And if you want to know which date you are pointing at with you mouse. You can implement a OnMouseMove
event:
procedure TForm60.cxDateNavigator1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
dt: TDateTime;
begin
dt := TcxDateNavigator(Sender).HitTest.Time;
if dt = NullDate then
Caption := 'You are pointing outside the calendar area'
else
Caption := 'You are pointing at ' + FormatDateTime(FormatSettings.LongDateFormat, dt);
end;