2012-04-10 4 views
3

TMontCalendar는 Windows 래퍼 인 것처럼 보이므로 새 VCL 스타일에 영향을받지 않습니다. 해결책을 알고 있습니까?TMonthCalendar 및 Delphi 스타일 (Delphi XE2)

+3

에 대한 [VCL-스타일 앤 소유자가됩니다 -draw] (http://theroadtodelphi.wordpress.com/2012/03/14/vcl-styles-and-owner-draw/). 특히 [TStyleHook] (http://docwiki.embarcadero.com/Libraries/en/Vcl.Themes.TStyleHook). –

+1

다음은 VCL 스타일을 사용하기 위해 TWebBrowser를 해킹 한 사용자입니다. http://theroadtodelphi.wordpress.com/2012/03/20/delphi-vcl-styles-and-twebbrowser-source-code-released/ –

+1

그리고이 또한 도움이 될 수 있습니다. http://theroadtodelphi.wordpress.com/2012/03/14/vcl-styles-and-owner-draw/ –

답변

6

TMonthCalendarMONTHCAL_CLASS에 대한 래퍼이며, 지금까지 내가이 컨트롤이 소유자 그리기를 지원하지 않습니다 알고 있지만 달력의 요소의 색상을 설정하기 위해 허용 CalColors 속성을 제공하지만,이 속성에만 작동 테마는 사용할 수 없습니다. 먼저 SetWindowTheme 함수를 호출하여 캘린더에서 테마를 사용하지 않도록 설정 한 다음 색상을 vcl 스타일과 일치하도록 설정할 수 있습니다. 이

uses 
    Vcl.Styles, 
    Vcl.Themes, 
    uxTheme; 

Procedure SetVclStylesColorsCalendar(MonthCalendar: TMonthCalendar); 
Var 
    LTextColor, LBackColor : TColor; 
begin 
    uxTheme.SetWindowTheme(MonthCalendar.Handle, '', '');//disable themes in the calendar 
    MonthCalendar.AutoSize:=True;//remove border 

    //get the vcl styles colors 
    LTextColor:=StyleServices.GetSystemColor(clWindowText); 
    LBackColor:=StyleServices.GetSystemColor(clWindow); 

    //set the colors of the calendar 
    MonthCalendar.CalColors.BackColor:=LBackColor; 
    MonthCalendar.CalColors.MonthBackColor:=LBackColor; 
    MonthCalendar.CalColors.TextColor:=LTextColor; 
    MonthCalendar.CalColors.TitleBackColor:=LBackColor; 
    MonthCalendar.CalColors.TitleTextColor:=LTextColor; 
    MonthCalendar.CalColors.TrailingTextColor:=LTextColor; 
end; 

그리고 결과 등

뭔가이 RRUZ 당신에게 솔루션을 제공 할 때까지 읽고 할 수 있습니다

enter image description here enter image description here

+0

좋아 나는 거의 같았다. 하지만 네가 정말 더 분명하고 똑똑해! – philnext