C# 使用GDI 绘制三角形、圆形后并填充颜色
private void DrawBoneAgeAndAgeHeightPoint(Graphics g, System.Drawing.PointF AgeHeight_Point, System.Drawing.PointF BoneAgePoint)
{
System.Drawing.SolidBrush innerBrush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 0, 0, 139));
System.Drawing.Pen m_ControlPen = new System.Drawing.Pen(System.Drawing.Color.FromKnownColor(KnownColor.Blue));
int Control_PointSize = 8;
float bmd_Width = 4f;
float r = 6f;
//三角形
if (BoneAgePoint.X != 0 && BoneAgePoint.Y != 0)
{
BoneAgePoint.X = BoneAgePoint.X ;
BoneAgePoint.Y = BoneAgePoint.Y;
PointF[] point = new PointF[3];
for (int i = 0; i < 3; i++)
{
point[i] = new PointF((float)(r * Math.Cos((i * 2 * Math.PI / 3) - Math.PI / 2) + BoneAgePoint.X), (float)(r * Math.Sin(i * 2 * Math.PI / 3 - Math.PI / 2)) + BoneAgePoint.Y);
}
g.FillPolygon(innerBrush, point);
}
//圆形
if (AgeHeight_Point.X != 0 && AgeHeight_Point.Y != 0)
{
AgeHeight_Point.X = AgeHeight_Point.X;
AgeHeight_Point.Y = AgeHeight_Point.Y;
g.DrawEllipse(m_ControlPen, AgeHeight_Point.X - bmd_Width, AgeHeight_Point.Y - bmd_Width, Control_PointSize, Control_PointSize);
g.FillEllipse(innerBrush, AgeHeight_Point.X - bmd_Width, AgeHeight_Point.Y - bmd_Width, Control_PointSize, Control_PointSize);
}
}
标签:BoneAgePoint,填充,Point,C#,System,AgeHeight,GDI,Drawing,Math From: https://blog.csdn.net/wangnaisheng/article/details/137044428