修改bsCalendar.pas单元中的DrawCalendar:
procedure TbsSkinMonthCalendar.DrawCalendar(Cnvs: TCanvas);
var
R: TRect;
I, J: Integer;
FMonthOffset, X, Y, X2, Y2: Integer;
S: String;
ADay, DayNum: Integer;
begin
R := Rect(0, 0, Width, Height);
AdjustClientRect(R);
with Cnvs do
begin
Font := Self.DefaultFont;
if (SkinData <> nil) and (SkinData.ResourceStrData <> nil)
then
Font.Charset := SkinData.ResourceStrData.Charset;
Brush.Style := bsClear;
// draw caption
S := FormatDateTime('MMMM, YYYY', FDate);
Y := R.Top + 2;
X := Width div 2 - TextWidth(S) div 2;
if FIndex <> -1
then
Font.Color := CalActiveFontColor;
Font.Style := [fsBold];
TextOut(X, Y, S);
CellW := (RectWidth(R) - 2) div 7;
// draw week days
X := R.Left + 1;
Y := R.Top + BSize + 10;
for I := 0 to 6 do
begin
S := ShortDayNames[(Ord(FirstDayOfWeek) + I) mod 7 + 1];
X2 := (X+15) + CellW div 2 - TextWidth(S) div 2;
//X2 := X + CellW div 2 - TextWidth(S) div 2;
if s='星期日' then //在这里判断
s:='日';
if s='星期一' then
s:='一';
if s='星期二' then
s:='二';
if s='星期三' then
s:='三';
if s='星期四' then
s:='四';
if s='星期五' then
s:='五';
if s='星期六' then
s:='六';
TextOut(X2, Y, S);
X := X + CellW;
if s='星期日' then
s:='日';
if s='星期一' then
s:='一';
if s='星期二' then
s:='二';
if s='星期三' then
s:='三';
if s='星期四' then
s:='四';
if s='星期五' then
s:='五';
if s='星期六' then
s:='六';
//X := X + CellW;
end;
// draw bevel
BevelTop := Y + TextHeight('Wq') + 1;
Pen.Color := Font.Color;
MoveTo(R.Left + 1, BevelTop);
LineTo(R.Right - 1, BevelTop);
if FBoldDays then Font.Style := [fsBold] else Font.Style := [];
// draw month numbers
CellH := (R.Bottom - BevelTop - 4) div 6;
if FIndex <> -1
then
Font.Color := CalFontColor;
FMonthOffset := GetMonthOffset;
ADay := ExtractDay(FDate);
Y := BevelTop + 3;
for J := 0 to 6 do
begin
X := R.Left + 1;
for I := 0 to 6 do
begin
DayNum := FMonthOffset + I + (J - 1) * 7;
if (DayNum < 1) or (DayNum > DaysThisMonth) then S := ''
else S := IntToStr(DayNum);
X2 := X + CellW div 2 - TextWidth(S) div 2;
Y2 := Y - CellH div 2 - TextHeight(S) div 2;
if S <> '' then TextOut(X2, Y2, S);
if DayNum = ADay
then
begin
if FIndex <> -1
then
Pen.Color := CalActiveFontColor
else
Pen.Color := Font.Color;
Rectangle(X, Y - CellH, X + CellW, Y);
end;
X := X + CellW;
end;
Y := Y + CellH;
end;
end;
end;