tvplanit: Fix some more drawing glitches in monthview

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8444 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-04 22:27:33 +00:00
parent d2bdaad7bf
commit 35584e4dd2
2 changed files with 14 additions and 13 deletions

View File

@ -102,7 +102,7 @@ procedure TVpMonthViewPainter.DrawDayCell(ADate: TDate; ACol, ARow: Integer;
var
tmpRect: TRect;
Y, M, D: Word;
Str: String;
str: String;
todayDate: TDate;
fontStyle: TFontStyles;
textAdjust: Integer;
@ -150,7 +150,7 @@ begin
end;
{ Prepare the day number as string}
Str := FormatDateTime('d', ADate);
str := FormatDateTime('d', ADate);
{ Set the proper font and style }
if ADate = todayDate then
@ -190,25 +190,25 @@ begin
RenderCanvas.Font.Style := FMonthView.DayNumberFont.Style;
end;
end;
FontStyle := RenderCanvas.Font.Style;
RenderCanvas.Font.Style := [fsBold, fsItalic];
textAdjust := RenderCanvas.TextWidth(Str);
textHeight := RenderCanvas.TextHeight(Str);
RenderCanvas.Font.Style := FontStyle;
if DisplayMonth <> M then
RenderCanvas.Font.Color := FMonthView.OffDayFontColor;
if FCurrHoliday <> '' then
RenderCanvas.Font.Assign(FMonthView.HolidayAttributes.Font);
FontStyle := RenderCanvas.Font.Style;
RenderCanvas.Font.Style := [fsBold, fsItalic];
textAdjust := RenderCanvas.TextWidth(str);
textHeight := RenderCanvas.TextHeight(str);
RenderCanvas.Font.Style := FontStyle;
{ Calculate size of rect for the day number at the top of the TextRect. }
if ACol = 6 then
tmpRect.Left := ATextRect.Left + mvColWidth - TextAdjust - FMonthView.DaysMargin
else
tmpRect.Left := ATextRect.Right - TextAdjust - FMonthView.DaysMargin + 2;
tmpRect.Left := ATextRect.Right - TextAdjust - FMonthView.DaysMargin;
if fsItalic in RenderCanvas.Font.Style then
dec(tmpRect.Left, 2);
tmpRect.Top := ATextRect.Top + FMonthView.DaysMargin div 2;
tmpRect.Top := ATextRect.Top + FMonthView.DaysMargin;
tmpRect.Right := tmpRect.Left + textAdjust;
tmpRect.Bottom := tmpRect.Top + textHeight;
@ -233,6 +233,7 @@ begin
mvMonthDayArray[AIndex].Date := ADate;
mvMonthDayArray[AIndex].OffDay := DisplayMonth <> M;
end;
Inc(ADayNumber);
Inc(AIndex);
@ -510,7 +511,7 @@ begin
TextRect.TopLeft := Point(dayRect.Left+1, dayRect.Top+1);
TextRect.BottomRight := Point(
TextRect.Left + mvColWidth,
TextRect.Top + mvEventTextHeight + txtMargin// div 2
TextRect.Top + mvEventTextHeight + txtMargin
);
{ set canvas color }
@ -533,7 +534,7 @@ begin
{ shorten events that are next to the day number, in order }
{ to give the day number enough room }
if (TextRect.Top < dayRect.Top + mvDayNumberHeight + txtMargin div 2)
if (TextRect.Top < dayRect.Top + mvDayNumberHeight + txtMargin)
then
TextRect.Right := TextRect.Left + mvColWidth - mvDayNumberHeight - txtMargin * 2
else

View File

@ -586,7 +586,7 @@ end;
procedure TVpWeekViewPainter.DrawHeader;
var
headRect, R: TRect;
headTextRect: TRect;
// headTextRect: TRect;
headStr: string = '';
headStrLen: Integer;
maxStrLen: Integer;