Live drawing

Submitted by eLenka on 4 August, 2010 - 15:12
Live drawing on Flash Canvas

Live Drawing demonstration. The TFlashCanvas control was created based on TFlashPlayer control, so now you can draw lines using "down and drag" without creating any temporary SWF files.

Source archive: live-draw.zip (368 KB)

 
Some sample source: 
procedure TForm4.FlashMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
    if isDown then
    begin
        with Flash.FlashCanvas do
        begin
          Clear;
          case RGType.ItemIndex of
           0:begin
              Pen.Color := clBlue;
              MoveTo(PStart.X, PStart.Y);
              LineTo(X, Y);
             end;
           1:begin
              Pen.Color := clGreen;
              Rectangle(PStart.X, PStart.Y, X, Y);
             end;
           2:begin
              Pen.Color := clRed;
              Ellipse(PStart.X, PStart.Y, X, Y);
             end;
          end;
        end;
        Flash.UpdateCanvas;
    end;
end;