Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TTMSFNCCalendar: Weekend Colour.

 Post Reply Post Reply
Author
Gill Steven View Drop Down
New Member
New Member
Avatar

Joined: 31 Aug 2017
Posts: 37
Post Options Post Options   Quote Gill Steven Quote  Post ReplyReply Direct Link To This Post Topic: TTMSFNCCalendar: Weekend Colour.
    Posted: 15 Aug 2019 at 1:09am
Is it possible to display the weekend days (ie. Saturday and Sunday) in a different colour than the other days like TPlannerCalendar?

= Steve

Back to Top
Dmitruk Pawel View Drop Down
New Member
New Member
Avatar

Joined: 18 May 2016
Posts: 4
Post Options Post Options   Quote Dmitruk Pawel Quote  Post ReplyReply Direct Link To This Post Posted: 15 Aug 2019 at 7:16am
procedure TForm1.TMSFNCCalendar2AfterDrawDayNumbers(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; ADate: TDate);
begin
  //saturday
  if (DayOfWeek(ADate)=7) and not TMSFNCCalendar2.SelectedDates.InCollection(ADate) then
  begin
    AGraphics.Fill.Color:=clGreen;
    AGraphics.DrawRectangle(ARect);
  end;
  //sunday
  if (DayOfWeek(ADate)=1) and not TMSFNCCalendar2.SelectedDates.InCollection(ADate) then
  begin
    AGraphics.Fill.Color:=clRed;
    AGraphics.DrawRectangle(ARect);
  end;
end;
Back to Top
Gill Steven View Drop Down
New Member
New Member
Avatar

Joined: 31 Aug 2017
Posts: 37
Post Options Post Options   Quote Gill Steven Quote  Post ReplyReply Direct Link To This Post Posted: 15 Aug 2019 at 8:54am
Originally posted by Dmitruk Pawel

procedure TForm1.TMSFNCCalendar2AfterDrawDayNumbers(Sender: TObject;
  AGraphics: TTMSFNCGraphics; ARect: TRectF; ADate: TDate);
begin
  //saturday
  if (DayOfWeek(ADate)=7) and not TMSFNCCalendar2.SelectedDates.InCollection(ADate) then
  begin
    AGraphics.Fill.Color:=clGreen;
    AGraphics.DrawRectangle(ARect);
  end;
  //sunday
  if (DayOfWeek(ADate)=1) and not TMSFNCCalendar2.SelectedDates.InCollection(ADate) then
  begin
    AGraphics.Fill.Color:=clRed;
    AGraphics.DrawRectangle(ARect);
  end;
end;


Awesome.  Thanks Dmitruk!

= Steve
Back to Top
Gill Steven View Drop Down
New Member
New Member
Avatar

Joined: 31 Aug 2017
Posts: 37
Post Options Post Options   Quote Gill Steven Quote  Post ReplyReply Direct Link To This Post Posted: 15 Aug 2019 at 9:17am
Hmm, strange.  Delphi reports that TRectF is an undeclared identifier, yet VCL.TMSFNCTypes is in the Uses clause.

= Steve
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7918
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 15 Aug 2019 at 9:18am
Add Types
Back to Top
Gill Steven View Drop Down
New Member
New Member
Avatar

Joined: 31 Aug 2017
Posts: 37
Post Options Post Options   Quote Gill Steven Quote  Post ReplyReply Direct Link To This Post Posted: 15 Aug 2019 at 9:57am
Originally posted by Bruno Fierens

Add Types


Thanks Bruno.  I thought I already had that but you're right, it wasn't there.

= Steve
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down