以一点(x,y)为圆心,r为半径画一个实心园,C#怎么实现?谢谢!

解决方案 »

  1.   

         private void button1_Click(object sender, EventArgs e)
            {
                Graphics _Graphcis =Graphics.FromHwnd(panel1.Handle);            _Graphcis.DrawEllipse(new Pen(Brushes.Yellow),GetEllopse(new Point(100,100),100));        }        public Rectangle GetEllopse(Point p_CenterPoint, int p_Radius)
            {
                int _X = p_CenterPoint.X - p_Radius;
                int _Y = p_CenterPoint.Y - p_Radius;
                return new Rectangle(_X, _Y, p_Radius * 2, p_Radius * 2);
            }
      

  2.   

    先计算出外截矩形,然后参考下面代码。外截矩形宽=2r 高=2r
    int w = Convert.ToInt32(TextBox1.Text) * 2;
            int h = Convert.ToInt32(TextBox1.Text) * 2;
            Image1.Width = w;
            Image1.Height = h;
            Bitmap bmp = new Bitmap(w, h);
            Graphics g = Graphics.FromImage(bmp);
            g.FillEllipse(new SolidBrush(Color.Red),0,0,w,h);
            bmp.Save(Server.MapPath("~/a.bmp"));
            Image1.ImageUrl = "~/a.bmp";
            g.Dispose(); 
      

  3.   

    我就想在picturebox里面画一个实心圆,没有bmp需要在控件的paint里面画出来
      

  4.   

    g.FillEllipse(new SolidBrush(Color.Red),0,0,w,h);正解