LCL-CustomDrawn: Implements FrameRect

git-svn-id: trunk@36600 -
This commit is contained in:
sekelsenmat 2012-04-06 10:16:42 +00:00
parent 1cdd557bba
commit 2c6aed50c6
2 changed files with 37 additions and 9 deletions

View File

@ -2391,25 +2391,53 @@ begin
Result := True; Result := True;
end; end;
(*{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: FrameRect Function: FrameRect
Params: none Params: none
Returns: Nothing Returns: Nothing
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TQtWidgetSet.FrameRect(DC: HDC; const ARect: TRect; function TCDWidgetSet.FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer;
hBr: HBRUSH): Integer; var
LazDC: TLazCanvas absolute DC;
lOldBrush, lOldPen, lFramePen, lFrameBrush: HGDIOBJ;
lLogPen: TLogPen;
lLogBrush: TLogBrush;
begin begin
Result := 0; Result := 0;
if not IsValidDC(DC) then Exit; {$ifdef VerboseCDDrawing}
DebugLn('[WinAPI FillRect Rect=', dbgs(ARect),' Brush=', dbghex(hBr));
{$endif}
TQtDeviceContext(DC).qDrawPLainRect(ARect.Left, ARect.Top, if not IsValidDC(DC) then
ARect.Right - ARect.Left, ARect.Bottom - ARect.Top); exit;
if not IsValidGdiObject(hBr) then
exit;
// Creates temporary pen and brush to help the drawing
lLogPen.lopnStyle := PS_SOLID;
lLogPen.lopnWidth := Point(1, 1);
lLogPen.lopnColor := FPColorToTColor(TFPCustomBrush(hBR).FPColor);
lFramePen := CreatePenIndirect(lLogPen);
lLogBrush.lbStyle := BS_NULL;
lFrameBrush := CreateBrushIndirect(lLogBrush);
// Do the drawing
lOldBrush := SelectObject(DC, lFrameBrush);
lOldPen := SelectObject(DC, lFramePen);
LazDC.Rectangle(ARect);
SelectObject(DC, lOldBrush);
SelectObject(DC, lOldPen);
// Delete the helper objects
DeleteObject(lFramePen);
DeleteObject(lFrameBrush);
Result := 1; Result := 1;
end; end;
function TQtWidgetSet.GetActiveWindow: HWND; (*function TQtWidgetSet.GetActiveWindow: HWND;
var var
Widget: QWidgetH; Widget: QWidgetH;
W: TQtWidget; W: TQtWidget;

View File

@ -99,9 +99,9 @@ function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str:
function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override; function FillRect(DC: HDC; const Rect: TRect; Brush: HBRUSH): Boolean; override;
//function FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): Bool; override; //function FillRgn(DC: HDC; RegionHnd: HRGN; hbr: HBRUSH): Bool; override;
function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TBevelCut): Boolean; override; function Frame3d(DC: HDC; var ARect: TRect; const FrameWidth : integer; const Style : TBevelCut): Boolean; override;
(*function FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer; override; function FrameRect(DC: HDC; const ARect: TRect; hBr: HBRUSH): Integer; override;
function GetActiveWindow : HWND; override; (*function GetActiveWindow : HWND; override;
function GetBitmapBits(Bitmap: HBITMAP; Count: Longint; Bits: Pointer): Longint; override; function GetBitmapBits(Bitmap: HBITMAP; Count: Longint; Bits: Pointer): Longint; override;
function GetBkColor(DC: HDC): TColorRef; override; function GetBkColor(DC: HDC): TColorRef; override;
function GetCapture: HWND; override; function GetCapture: HWND; override;