日期:2014-05-17 浏览次数:21138 次
public void PaintCircleHand(Graphics g, Pen pen, int point_x, int radius)
{
//Graphics g = this.CreateGraphics();
g.SmoothingMode = SmoothingMode.AntiAlias;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
//更改坐标系统的原点,新原点即为圆心
g.TranslateTransform(this.Width / 2, this.Height / 2);
//定义指针坐标
Point PPoint = new Point();
Point PSPoint = new Point();
//根据鼠标X坐标计算指针Y坐标
//三种情况
if (point_x <= -radius && point_x >= -radius - 20)
{
PPoint.X = -radius - (point_x + radius);
PPoint.Y = Convert.ToInt32(Math.Sqrt((radius * radius) - (PPoint.X * PPoint.X)));
}
else if (point_x >= radius && point_x <= radius + 20)
{
PPoint.X = radius - (point_x - radius);
PPoint.Y = Convert.ToInt32(Math.Sqrt((radius * radius) - (PPoint.X * PPoint.X)));
}