c#:画圆(整理)


  • Random random = new Random();

  •   

  • Color getRandomColor()

  • {

  •     return Color.FromArgb(

  •          random.Next(256) ,

  •          random.Next(256) ,

  •          random.Next(256) );

  • }

  •   

  • private void button1_Click(object sender, System.EventArgs e)

  • {

  •     Graphics g = this.CreateGraphics();

  •   

  •     int x0 = this.Width /2;

  •     int y0 = this.Height /2;

  •   

  •     forint r=0 ; r<this.Height/2; r++ )

  •     {

  •         g.DrawEllipse(

  •             new Pen( getRandomColor(),1), 

  •             x0-r,y0-r, r*2, r*2 

  •             );

  •     

  •     g.Dispose();        

  • }


  • 免责声明!

    本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



     
    粤ICP备18138465号  © 2018-2025 CODEPRJ.COM