0,0 → 1,62 |
unit Unit1; |
|
interface |
|
uses |
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
Dialogs, StdCtrls, ExtCtrls, ToolWin, ComCtrls; |
|
type |
TForm1 = class(TForm) |
PaintBox1: TPaintBox; |
Button1: TButton; |
Button2: TButton; |
ScrollBar1: TScrollBar; |
procedure Button1Click(Sender: TObject); |
procedure Button2Click(Sender: TObject); |
procedure ScrollBar1Change(Sender: TObject); |
|
private |
{ Private declarations } |
public |
{ Public declarations } |
end; |
|
var |
Form1: TForm1; |
|
implementation |
|
{$R *.dfm} |
|
procedure TForm1.Button1Click(Sender: TObject); |
begin |
with PaintBox1 do begin |
Canvas.Brush.Color := clRed; |
Canvas.Brush.Style := bsDiagCross; |
Canvas.Ellipse(0, 0, PaintBox1.Width, PaintBox1.Height); |
end; |
end; |
|
procedure TForm1.Button2Click(Sender: TObject); |
var Y: Integer; |
|
begin |
|
{ first call FillRect to paint the surface of the form. |
this removes any previously drawn lines (and anything else!) |
PaintBox1.Canvas.FillRect(ClientRect);} |
|
PaintBox1.Canvas.MoveTo(0, 0); |
PaintBox1.Canvas.LineTo(PaintBox1.Width,PaintBox1.Height); |
|
|
end; |
|
procedure TForm1.ScrollBar1Change(Sender: TObject); |
begin |
PaintBox1.Canvas.MoveTo(0,ScrollBar1.Position); |
PaintBox1.Canvas.LineTo(256,ScrollBar1.Position); |
end; |
|
end. |