放三个BitBtn上去。
procedure TForm1.ArcFx(x1, y1, x2, y2, x3, y3: Integer);
var
X0, Y0, r : Integer;
Xt, Yt, rt : extended;
begin
Xt := ((y3 - Y1) * (Y2 * Y2 - Y1 * Y1 + X2 * X2 - X1 * X1) + (Y2 - Y1) * (Y1
* Y1 - y3 * y3 + X1 * X1 - x3 * x3)) / (2 * (X2 - X1) * (y3 - Y1) - 2 * (x3
-
X1) * (Y2 - Y1));
Yt := ((x3 - X1) * (X2 * X2 - X1 * X1 + Y2 * Y2 - Y1 * Y1) + (X2 - X1) * (X1
* X1 - x3 * x3 + Y1 * Y1 - y3 * y3)) / (2 * (Y2 - Y1) * (x3 - X1) - 2 * (y3
-
Y1) * (X2 - X1));
X0 := Round(Xt);
Y0 := Round(Yt);
rt := sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
r := Round(rt);
Button1.Top := Y0;
Button1.Left := X0;
Button1.Caption := '圆心Left:' + inttostr(Button1.Left) + 'Top:' +
inttostr(Button1.Top);
Canvas.Arc(X0 - r, Y0 - r, X0 + r, Y0 + r, x2, y2, x3, y3);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
BitBtn1.Caption := 'A点Left:' + inttostr(BitBtn1.Left) + 'Top:' +
inttostr(BitBtn1.Top);
BitBtn2.Caption := 'B点Left:' + inttostr(BitBtn2.Left) + 'Top:' +
inttostr(BitBtn2.Top);
BitBtn3.Caption := 'C点Left:' + inttostr(BitBtn3.Left) + 'Top:' +
inttostr(BitBtn3.Top);
ArcFx(BitBtn1.Left, BitBtn1.Top, BitBtn2.Left, BitBtn2.Top,
BitBtn3.Left, BitBtn3.Top);
end;