Replace out-dated code which does not compile in 64bit mode in helpers.SetWindowSizeGrip. Use a TForm descendant in the new unit "extra_controls". Code parts taken from http://www.delphigroups.info/2/4/326787.html

This commit is contained in:
Ansgar Becker
2013-11-01 14:54:13 +00:00
parent 6d1acb1136
commit 6e608f157e
18 changed files with 94 additions and 192 deletions

61
source/extra_controls.pas Normal file
View File

@ -0,0 +1,61 @@
unit extra_controls;
interface
uses
Classes, SysUtils, Forms, Windows, Messages;
type
// Form with a sizegrip in the lower right corner, without the need for a statusbar
TFormWithSizeGrip = class(TForm)
private
FSizeGripRect: TRect;
FSizeGripWidth: Integer;
FSizeGripHeight: Integer;
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
public
constructor Create(AOwner: TComponent); override;
procedure Paint; override;
procedure Resize; override;
end;
implementation
{ TFormWithSizeGrip }
constructor TFormWithSizeGrip.Create(AOwner: TComponent);
begin
inherited;
FSizeGripWidth := GetSystemMetrics(SM_CXVSCROLL);
FSizeGripHeight := GetSystemMetrics(SM_CYHSCROLL);
end;
procedure TFormWithSizeGrip.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
if PtInRect(FSizeGripRect, ScreenToClient(SmallPointToPoint(Msg.Pos))) then
Msg.Result := HTBOTTOMRIGHT;
end;
procedure TFormWithSizeGrip.Paint;
begin
inherited;
DrawFrameControl(Canvas.Handle, FSizeGripRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
end;
procedure TFormWithSizeGrip.Resize;
begin
inherited;
FSizeGripRect := ClientRect;
FSizeGripRect.Left := FSizeGripRect.Right - FSizeGripWidth;
FSizeGripRect.Top := FSizeGripRect.Bottom - FSizeGripHeight;
Refresh;
end;
end.