Einzelnen Beitrag anzeigen

Muetze1
(Gast)

n/a Beiträge
 
#2

Re: VCL: Property ausblenden bei Ableitung?

  Alt 14. Dez 2007, 22:03
Mir war langweilig...

Delphi-Quellcode:
unit ExtMonthCalendar;

interface

uses
  ComCtrls;

type
  TOnGetMonthInfoExtEvent = procedure(Sender: TObject; Month, Year: LongWord; var MonthBoldInfo: LongWord) of object;

  TExtMonthCalendar = class(TMonthCalendar)
  private
    FOnGetMonthInfoExt: TOnGetMonthInfoExtEvent;

    procedure CNNotify(var Message: TWMNotify); message CN_NOTIFY;
  published
    property OnGetMonthInfoExt: TOnGetMonthInfoExtEvent read FOnGetMonthInfoExt write FOnGetMonthInfoExt;
  end;

implementation

procedure TExtMonthCalendar.CNNotify(var Message: TWMNotify);
var
  ST: PSystemTime;
  I, MonthNo: Integer;
  CurState: PMonthDayState;
begin
  inherited;

  with Message, NMHdr^ do
  begin
    if code = MCN_GETDAYSTATE then
    begin
      with PNmDayState(NMHdr)^ do
      begin
        FillChar(prgDayState^, cDayState * SizeOf(TMonthDayState), 0);
        if Assigned(FOnGetMonthInfoExt) then
        begin
          CurState := prgDayState;
          for I := 0 to cDayState - 1 do
          begin
            MonthNo := stStart.wMonth + I;
            if MonthNo > 12 then MonthNo := MonthNo - 12;
            FOnGetMonthInfoExt(Self, MonthNo, stStart.wYear, CurState^);
            Inc(CurState);
          end;
        end;
      end;
    end;
  end;
end;

end.
  Mit Zitat antworten Zitat