我打算使用 TMetafileCanvas 所以我已经开始寻找例子。在Embarcadero 方面,我找到了以下示例:
var
MyMetafile: TMetafile;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyMetafile := TMetafile.Create;
with TMetafileCanvas.Create(MyMetafile, 0) do
try
Brush.Color := clRed;
Ellipse(0, 0, 100, 200);
// ...
finally
// Free;
end;
Form1.Canvas.Draw(0, 0, MyMetafile); {1 red circle }
PaintBox1.Canvas.Draw(0, -50, MyMetafile); {1 red circle }
end;
我创建了一个新项目并放置了Form,Button和PaintBox,然后我复制了上面的示例,但是执行代码时没有任何反应并且表单保持不变!
显然我做错了什么!我必须做什么那个例子应该正确吗?