用以下代码截获OnDrawCellProperties事件的结果,便于更好的理解这个事件的每一个参数
function GetStateStr(AState: TFECalCellStates): String;
begin
Result := '';
if TFECalCellState.csCaption in AState then
Result := Result + ',csCaption';
if TFECalCellState.csFocused in AState then
Result := Result + ',csFocused';
if TFECalCellState.csNormal in AState then
Result := Result + ',csNormal';
if TFECalCellState.csNotInMonth in AState then
Result := Result + ',csNotInMonth';
if TFECalCellState.csSelected in AState then
Result := Result + ',csSelected';
if TFECalCellState.csSpecial in AState then
Result := Result + ',csSpecial';
if TFECalCellState.csToday in AState then
Result := Result + ',csToday';
if TFECalCellState.csWeekEnd in AState then
Result := Result + ',csWeekEnd';
Result := StringUtils.Copy(Result, 2, 1000);
end;
procedure TMainForm.FECalendar1DrawCellProperties(Sender: TObject; ADate: Double; AState: TFECalCellStates; var ALabel: string; CellProperties: TFECellProperties);
begin
AddLog(SysUtils.DateToStr(ADate)+#9+ALabel+#9+GetStateStr(AState));
end;
2008年7月22日运行的结果
运行结果
1899-12-30 星期一 csCaption
1899-12-30 星期二 csCaption
1899-12-30 星期三 csCaption
1899-12-30 星期四 csCaption
1899-12-30 星期五 csCaption
1899-12-30 星期六 csCaption
1899-12-30 星期日 csCaption
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
2008-7-1 1 csFocused,csNormal,csSelected
2008-7-2 2 csNormal
2008-7-3 3 csNormal
2008-7-4 4 csNormal
2008-7-5 5 csNormal,csWeekEnd
2008-7-6 6 csNormal,csWeekEnd
2008-7-7 7 csNormal
2008-7-8 8 csNormal
2008-7-9 9 csNormal
2008-7-10 10 csNormal
2008-7-11 11 csNormal
2008-7-12 12 csNormal,csWeekEnd
2008-7-13 13 csNormal,csWeekEnd
2008-7-14 14 csNormal
2008-7-15 15 csNormal
2008-7-16 16 csNormal
2008-7-17 17 csNormal
2008-7-18 18 csNormal
2008-7-19 19 csNormal,csWeekEnd
2008-7-20 20 csNormal,csWeekEnd
2008-7-21 21 csNormal
2008-7-22 22 csNormal,csToday
2008-7-23 23 csNormal
2008-7-24 24 csNormal
2008-7-25 25 csNormal
2008-7-26 26 csNormal,csWeekEnd
2008-7-27 27 csNormal,csWeekEnd
2008-7-28 28 csNormal
2008-7-29 29 csNormal
2008-7-30 30 csNormal
2008-7-31 31 csNormal
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth
1899-12-30 csNotInMonth |