win32: move statictext message handling to statictext window proc

git-svn-id: trunk@23639 -
This commit is contained in:
paul 2010-02-05 09:31:44 +00:00
parent f8a1f56fb6
commit 3d4f978f63
2 changed files with 28 additions and 6 deletions

View File

@ -2361,10 +2361,7 @@ begin
WM_NCPAINT:
begin
if (lWinControl <> nil) and TWin32ThemeServices(ThemeServices).ThemesEnabled and
not (lWinControl is TCustomForm) and
((lWinControl is TCustomControl) or
((lWinControl is TCustomStaticText) and (TCustomStaticText(lWinControl).BorderStyle = sbsSingle))
) then
not (lWinControl is TCustomForm) and (lWinControl is TCustomControl) then
begin
TWin32ThemeServices(ThemeServices).PaintBorder(lWinControl, True);
LMessage.Result := 0;

View File

@ -39,7 +39,7 @@ uses
////////////////////////////////////////////////////
WSControls, WSStdCtrls, WSLCLClasses, WSProc, Windows, LCLType, LCLProc,
InterfaceBase, LMessages, LCLMessageGlue,
Win32Int, Win32Proc, Win32WSControls, Win32Extra;
Win32Int, Win32Proc, Win32WSControls, Win32Extra, Win32Themes;
type
@ -212,7 +212,7 @@ type
TWin32WSCustomStaticText = class(TWSCustomStaticText)
published
class function CreateHandle(const AWinControl: TWinControl;
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND; override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer;
@ -1377,6 +1377,30 @@ end;
{ TWin32WSCustomStaticText }
function StaticTextWndProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
LParam: Windows.LParam): LResult; stdcall;
var
WindowInfo: PWin32WindowInfo;
begin
// move groupbox specific code here
case Msg of
WM_NCPAINT:
begin
WindowInfo := GetWin32WindowInfo(Window);
if Assigned(WindowInfo) and
TWin32ThemeServices(ThemeServices).ThemesEnabled and
(GetWindowLong(Window, GWL_EXSTYLE) and WS_EX_CLIENTEDGE <> 0) then
begin
TWin32ThemeServices(ThemeServices).PaintBorder(WindowInfo^.WinControl, True);
Result := 0;
end;
end;
else
Result := WindowProc(Window, Msg, WParam, LParam);
end;
end;
function CalcStaticTextFlags(
const AAlignment: TAlignment;
const ABorder: TStaticBorderStyle;
@ -1410,6 +1434,7 @@ begin
Flags := Flags and not WS_BORDER; // under XP WS_BORDER is not themed and there are some problems with redraw
FlagsEx := FlagsEx or WS_EX_CLIENTEDGE; // this is themed-border
end;
SubClassWndProc := @StaticTextWndProc;
end;
// create window
FinishCreateWindow(AWinControl, Params, false);