Advertisement

C#绘制奥运五环

阅读量:

C#窗体文件 写奥运五环

复制代码
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics gra = this.pictureBox1.CreateGraphics();
            Pen pen = new Pen (Color.Blue,6);
            gra .DrawEllipse (pen ,10,60,100,100);
    
            Graphics gra2 = this.pictureBox1.CreateGraphics();
            Pen pen2 = new Pen(Color.Black, 6);
            gra.DrawEllipse(pen2, 120, 60, 100, 100);
    
            Graphics gra3 = this.pictureBox1.CreateGraphics();
            Pen pen3 = new Pen(Color.Red, 6);
            gra.DrawEllipse(pen3, 230, 60, 100, 100);
    
            Graphics gra4 = this.pictureBox1.CreateGraphics();
            Pen pen4 = new Pen(Color.Yellow, 6);
            gra.DrawEllipse(pen4, 65, 110, 100, 100);
    
            Graphics gra5 = this.pictureBox1.CreateGraphics();
            Pen pen5 = new Pen(Color.Green, 6);
            gra.DrawEllipse(pen5, 175, 110, 100, 100);
        }
    }
    }
在这里插入图片描述

全部评论 (0)

还没有任何评论哟~