画圆弧800L里加急,关定存亡,救命!!!!!!

ghost_008 2005-10-26 11:50:09
我有一组数据,计算这组数据后得到给类数所占总额的百分比

我想根据各类数据的比例画一饼图(圆弧也可,把一圆分成几个扇行)

在Bitmap.canvas中如何实现,
Bitmap.Canvas.Arc();
Bitmap.Canvas.Pie();
参数如何设定????
...全文
177 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sjtuyjc 2005-10-28
  • 打赏
  • 举报
回复
Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.

Delphi syntax:

procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);

C++ syntax:

void __fastcall Arc(int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4);

Description

Use Arc to draw an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4).

Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.

On NT or Windows 2000, the drawing direction can be changed to clockwise using the Windows API call SetArcDirection.
sjtuyjc 2005-10-28
  • 打赏
  • 举报
回复
难道自己看一下 Help 就不可以吗?
baiduan 2005-10-27
  • 打赏
  • 举报
回复
Bitmap.Canvas.Arc();
共有8个参数,前四个是弧所在的rect的right,top,bottom,left参数
后四个是弧的right,top,bottom,top参数,
例如
canvas.arc(0,800,600,0,0,0,600,800)
具体的自己试一试就okle。
chinasdp 2005-10-27
  • 打赏
  • 举报
回复
试试我的方法:
procedure TForm1.Draw(items: array of integer);
var
ox, oy, r, i, sum, a: integer;
f: single;
cls: array of TColor;
begin
sum := 0;// 数值总和
a := 0;// 角度
r := 100;// 半径
ox := 120;// 圆心横坐标
oy := 120;// 圆心纵坐标
// 随机颜色
SetLength(cls, Length(items));
for i := Low(items) to High(items) do
cls[i] := RGB(Random(Random(255)), Round(Random(255)), Round(Random(255)));
for i := Low(items) to High(items) do
Inc(sum, items[i]);
f := 2 * pi / sum;// 角度的系数
for i := Low(items) to High(items) do
begin
Image1.Canvas.Brush.Color := cls[i];
Image1.Canvas.Pie(
ox - r, oy - r,
ox + r, oy + r,
ox + Round(r * cos(f * a)), oy - Round(r * sin(f * a)),
ox + Round(r * cos(f * (a + items[i]))), oy - Round(r * sin(f * (a + items[i]))));
Inc(a, items[i]);
end;
end;

测试:
Draw([1,5,3,4,5,6,10,4]);

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧