zoukankan      html  css  js  c++  java
  • Circle

     1 using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Threading.Tasks;
     9 using System.Windows.Forms;
    10 
    11 namespace Circle
    12 {
    13     public partial class Form1 : Form
    14     {
    15         public Form1()
    16         {
    17             InitializeComponent();
    18         }
    19 
    20         Random random = new Random();
    21 
    22         Color getRandomColor()
    23         {
    24             return Color.FromArgb(
    25                  random.Next(256),
    26                  random.Next(256),
    27                  random.Next(256));
    28         }
    29 
    30         protected override void OnPaint(PaintEventArgs e)
    31         {
    32             Graphics g = this.CreateGraphics();
    33             int x0 = this.Width / 2;
    34             int y0 = this.Height / 2;
    35 
    36             for (int r = 0; r < this.Height / 2; r++)
    37             {
    38                 g.DrawEllipse(
    39                     new Pen(getRandomColor(), 1),
    40                     x0 - r,
    41                     y0 - r/2,
    42                     r * 2,
    43                     r * 2
    44                 );
    45             }
    46             g.Dispose();
    47         }
    48     }
    49 }
  • 相关阅读:
    ZOJ 3490 String Successor
    ZOJ 3465 The Hive
    ZOJ 3077 Move to Baggage Office
    ZOJ 2836 Number Puzzle
    POJ 2115 C Looooops
    ZOJ 3605 Find the Marble
    扩展欧几里德
    搭配飞行员(网络流)
    最小费用流
    最大流
  • 原文地址:https://www.cnblogs.com/GoldenEllipsis/p/10436115.html
Copyright © 2011-2022 走看看