implement TWin32WidgetSet.GetDCOriginRelativeToWindow

git-svn-id: trunk@7024 -
This commit is contained in:
micha 2005-03-25 16:41:35 +00:00
parent 09233bbe50
commit 8f6d8166b8
2 changed files with 27 additions and 0 deletions

View File

@ -1473,6 +1473,26 @@ begin
Result := Windows.GetDC(OverlayWindow);
end;
function TWin32WidgetSet.GetDCOriginRelativeToWindow(PaintDC: HDC;
WindowHandle: HWND; var OriginDiff: TPoint): boolean;
var
DCOrg, winOrg: Windows.POINT;
ORect: TRect;
begin
OriginDiff.X := 0;
OriginDiff.Y := 0;
Result := Windows.GetDCOrgEx(PaintDC, DCOrg);
if not Result then exit;
winOrg.X := 0;
winOrg.Y := 0;
Result := Windows.ClientToScreen(WindowHandle, winOrg);
if not Result then exit;
Result := GetLCLClientBoundsOffset(WindowHandle, ORect);
if not Result then exit;
OriginDiff.X := DCOrg.X - winOrg.X - ORect.Left;
OriginDiff.Y := DCOrg.Y - winOrg.Y - ORect.Top;
end;
function TWin32WidgetSet.GetDeviceSize(DC: HDC; var P: TPoint): Boolean;
var
hBitmap: HGDIOBJ;
@ -3096,6 +3116,9 @@ end;
{ =============================================================================
$Log$
Revision 1.140 2005/03/25 16:41:35 micha
implement TWin32WidgetSet.GetDCOriginRelativeToWindow
Revision 1.139 2005/03/14 21:49:41 micha
check nil pointer to avoid AV (by jesusrmx)

View File

@ -99,6 +99,7 @@ Function GetDC(HWnd: HWND): HDC; Override;
function GetDeviceCaps(DC: HDC; Index: Integer): Integer; Override;
function GetDeviceSize(DC: HDC; var P: TPoint): Boolean; Override;
function GetDesignerDC(WindowHandle: HWND): HDC; Override;
function GetDCOriginRelativeToWindow(PaintDC: HDC; WindowHandle: HWND; var OriginDiff: TPoint): boolean; override;
function GetDIBits(DC: HDC; Bitmap: HBitmap; StartScan, NumScans: UINT; Bits: Pointer; var BitInfo: BitmapInfo; Usage: UINT): Integer; Override;
function GetBitmapBits(Bitmap: HBITMAP; Count: Longint; Bits: Pointer): Longint; Override;
Function GetFocus: HWND; Override;
@ -196,6 +197,9 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
{ =============================================================================
$Log$
Revision 1.56 2005/03/25 16:41:35 micha
implement TWin32WidgetSet.GetDCOriginRelativeToWindow
Revision 1.55 2005/03/04 13:50:09 mattias
fixed Arc and changed x,y to Left,Top to make meaning more clear