[Lazarus] [WINCE] Canvas.ClipRect get as Parent coordinate.

Zaher Dirkey parmaja at gmail.com
Tue Aug 17 11:27:50 CEST 2010


On Tue, Aug 17, 2010 at 8:03 AM, Felipe Monteiro de Carvalho <
felipemonteiro.carvalho at gmail.com> wrote:

> MoveWindowOrg is very problematic under Windows CE, it basically
> destroys all native drawing of controls if overused.
>

Yes it is WinCE issue, i have tested with native API, ClipRect not moved to
new coordinates, but MoveWindowOrg worked in WinCE

--------------------------------------------------------
procedure TForm1.Paint;
var
  R: TRect;
  sdc: Integer;
begin
  inherited Paint;
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
  sdc := SaveDC(Canvas.Handle);
  MoveWindowOrg(Canvas.Handle, 100, 100);
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
  RestoreDC(Canvas.Handle, sdc);
  Windows.GetClipBox(Canvas.Handle, @R);
  Log(PrintRect(R));
end;
--------------------------------------------------------


The next example it used to test MoveWindowOrg and it is worked,
--------------------------------------------------------
procedure TForm1.Button3Click(Sender: TObject);
var
  R: TRect;
begin
  R:= Rect(10, 100, 60, 150);
  Canvas.Brush.Style := bsClear;
  Canvas.Pen.Color := clGreen;
  Canvas.Rectangle(R);
  MyMoveWindowOrg(Canvas.Handle, 50, 50);
  Canvas.Brush.Style := bsClear;
  Canvas.Pen.Color := clGreen;
  Canvas.Rectangle(R);
end;
--------------------------------------------------------

What if implement the GetClipRect in WinCE wedgetset to offset the rect
depenf on the new coordinaed by call GetWindowsOrgEx, I will test it

function TWinCEWidgetSet.GetClipBox(DC : hDC; lpRect : PRect) : Longint;
var
  P: TPoint;
begin
  Result := Windows.GetClipBox(DC, Windows.LPRECT(lpRect));
  LCLIntf.GetWindowOrgEx(DC, @P);
  OffsetRect(lpRect^, -P.x, -P.y);
end;

Thanks
-- 
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100817/ee9de298/attachment-0004.html>


More information about the Lazarus mailing list