In VCL I can use Canvas.Draw to copy a bitmap to a paintbox canvas. This works ok but when I try the same thing with Web Core I can't seem to get it to work, this is the code I used in TMS Web Core. I placed a button and paintbox onto a web form, and attach the onpaint event. When I click on the button I don't see any line drawn. Am I doing this the right way?
type
TForm1 = class(TWebForm)
WebPaintBox1: TWebPaintBox;
WebButton1: TWebButton;
procedure WebButton1Click(Sender: TObject);
procedure WebPaintBox1Paint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
b : TBitmap;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WebButton1Click(Sender: TObject);
begin
b := TBitmap.Create;
b.height := WebPaintBox1.Height;
b.width := WebPaintBox1.Width;
b.canvas.pen.color := clBlack;
b.canvas.Pen.width := 2;
b.Canvas.MoveTo (20, 20);
b.Canvas.LineTo (400, 300);
WebPaintBox1.Invalidate;
end;
procedure TForm1.WebPaintBox1Paint(Sender: TObject);
begin
if b <> nil then
begin
WebPaintBox1.Canvas.Draw (0, 0, b);
end;
end;