//参考如下API//现在比较忙没有时间和你玩 :( BOOL Chord( HDC hdc, // handle to device context int nLeftRect, // x-coordinate of the upper-left corner of the bounding rectangle int nTopRect, // y-coordinate of the upper-left corner of the bounding rectangle int nRightRect, // x-coordinate of the lower-right corner of the bounding rectangle int nBottomRect, // y-coordinate of the lower-right corner of the bounding rectangle int nXRadial1, // x-coordinate of the first radial's endpoint int nYRadial1, // y-coordinate of the first radial's endpoint int nXRadial2, // x-coordinate of the second radial's endpoint int nYRadial2 // y-coordinate of the second radial's endpoint );BOOL AngleArc( HDC hdc, // handle to device context int X, // x-coordinate of circle's center int Y, // y-coordinate of circle's center DWORD dwRadius, // circle's radius FLOAT eStartAngle, // arc's start angle FLOAT eSweepAngle // arc's sweep angle ); BOOL Arc( HDC hdc, // handle to device context int nLeftRect, // x-coordinate of bounding rectangle's upper-left corner int nTopRect, // y-coordinate of bounding rectangle's upper-left corner int nRightRect, // x-coordinate of bounding rectangle's lower-right corner int nBottomRect, // y-coordinate of bounding rectangle's lower-right corner int nXStartArc, // first radial ending point int nYStartArc, // first radial ending point int nXEndArc, // second radial ending point int nYEndArc // second radial ending point ); BOOL ArcTo( HDC hdc, // handle to device context int nLeftRect, // x-coordinate of bounding rectangle's upper-left corner int nTopRect, // y-coordinate of bounding rectangle's upper-left corner int nRightRect, // x-coordinate of bounding rectangle's lower-right corner int nBottomRect, // y-coordinate of bounding rectangle's lower-right corner int nXRadial1, // x-coordinate of the first radial ending point int nYRadial1, // y-coordinate of the first radial ending point int nXRadial2, // x-coordinate of the second radial ending point int nYRadial2 // y-coordinate of the second radial ending point );
unit Unit1;interfaceuses
Windows, Messages, SysUtils, 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;
Point1,Point2: TPoint;
start:boolean=false;
implementation{$R *.DFM}procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Point1.x := X;
Point1.y := Y;
Point2.x := X;
Point2.y := Y;
start:=true;
end;procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if start then
begin
Canvas.Brush.Style := bsClear;
Canvas.Pen.Mode := pmNotXor;
Canvas.Pen.Style := psDot;
Canvas.Ellipse(Point1.x,Point1.y,Point2.x,Point2.y);
Point2.x := x;
Point2.y := y;
Canvas.Ellipse(Point1.x,Point1.y,Point2.x,Point2.y);
end;
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Canvas.Pen.Style := psSolid;
Canvas.Pen.Mode := pmCopy;
Canvas.Ellipse(Point1.x,Point1.y,X,Y);
start:=false;
end;end.
BOOL Chord( HDC hdc, // handle to device context
int nLeftRect, // x-coordinate of the upper-left corner of the bounding rectangle
int nTopRect, // y-coordinate of the upper-left corner of the bounding rectangle
int nRightRect, // x-coordinate of the lower-right corner of the bounding rectangle
int nBottomRect, // y-coordinate of the lower-right corner of the bounding rectangle
int nXRadial1, // x-coordinate of the first radial's endpoint
int nYRadial1, // y-coordinate of the first radial's endpoint
int nXRadial2, // x-coordinate of the second radial's endpoint
int nYRadial2 // y-coordinate of the second radial's endpoint
);BOOL AngleArc( HDC hdc, // handle to device context
int X, // x-coordinate of circle's center
int Y, // y-coordinate of circle's center
DWORD dwRadius, // circle's radius
FLOAT eStartAngle, // arc's start angle
FLOAT eSweepAngle // arc's sweep angle
);
BOOL Arc( HDC hdc, // handle to device context
int nLeftRect, // x-coordinate of bounding rectangle's upper-left corner
int nTopRect, // y-coordinate of bounding rectangle's upper-left corner
int nRightRect, // x-coordinate of bounding rectangle's lower-right corner
int nBottomRect, // y-coordinate of bounding rectangle's lower-right corner
int nXStartArc, // first radial ending point
int nYStartArc, // first radial ending point
int nXEndArc, // second radial ending point
int nYEndArc // second radial ending point
);
BOOL ArcTo( HDC hdc, // handle to device context
int nLeftRect, // x-coordinate of bounding rectangle's upper-left corner
int nTopRect, // y-coordinate of bounding rectangle's upper-left corner
int nRightRect, // x-coordinate of bounding rectangle's lower-right corner
int nBottomRect, // y-coordinate of bounding rectangle's lower-right corner
int nXRadial1, // x-coordinate of the first radial ending point
int nYRadial1, // y-coordinate of the first radial ending point
int nXRadial2, // x-coordinate of the second radial ending point
int nYRadial2 // y-coordinate of the second radial ending point
);
你已知圆心与两个点,(当然还有圆心角),画这段弧应当很简单了吧。看看去,我想你不必再问了。
http://www.csdn.net/Expert/TopicView1.asp?id=917734
主题:回答 taxi (菜得惊动毛主席) 关于圆心之问题 (leeky )