Discussion:
Run time Map Mode problem
(too old to reply)
V***@gmail.com
2007-06-30 19:31:22 UTC
Permalink
Does any expl to me this or give me some ideas

TMyDraw = class(TCustomControl)

TMyDraw.Paint
begin
inherited;
SetMapMode(Canvas.Handle, MM_LOMETRICS);
SetViewportOrgEx(Canvas.Handle, 0, ClientHeight);
R := Rect(0, 0, 1000, 1000);
with R do
Canvas.Rectangle(Left, Top, Right, Bottom);
InflateRect(R< -100, -100)
with R do
Canvas.Rectangle(Left, Top, Right, Bottom);
end;
- - - -

works fine when I put control on form in design mode and run program,
but when control is dynamic created in run - time mode

MyDraw := TMyDraw.Create(Self);
MyDraw.parent := Self;
etc etc ...

all is wrong. Square is 2x bigger and pen width 3x bigger.
V***@gmail.com
2007-07-01 06:38:09 UTC
Permalink
I know, this is problem

constructor TMyDraw.Create;
begin
----- ---- ----
DoubleBuffered := True;
end;

but, I don't know why?

Loading...