老人家,多谢回答,请来拿分,还有一问题(30分)

  • 主题发起人 主题发起人 mymy
  • 开始时间 开始时间
M

mymy

Unregistered / Unconfirmed
GUEST, unregistred user!
用你的代码画角,仍好像是两条线嘛
 
不会的在实事
用其它颜色
给分把
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm)
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
bb: Boolean = False;
PX,PY,PX1,PY1: Integer;

implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if bb = False then
begin
Form1.Canvas.Pen.Color := clred;
Form1.Canvas.Pen.Width := 1;
Form1.Canvas.Pen.Style := psSolid;
//Form1.Canvas.Pen.Mode := pmBlack;
PX := X;
PY := Y;
BB := True;
end;
end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if bb = True then
begin
Form1.Canvas.Pen.Color := clBtnFace;
Form1.Canvas.MoveTo(PX,PY);
Form1.Canvas.lineto(PX1,PY1);
Form1.Canvas.Pen.Color := clred;
Form1.Canvas.MoveTo(PX,PY);
Form1.Canvas.LineTo(X,Y);
PX1:=X;
PY1:=Y;
end;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
BB:= False;
form1.Update;
end;

end.
 
多谢,你咋这么急着要分,挺现实的嘛。
 
后退
顶部