C#中简单的绘图

来源:互联网 发布:跑跑卡丁车淘宝好便宜 编辑:程序博客网 时间:2024/05/22 09:05
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace picture2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {
            
        }


        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            Pen Mypen = new Pen(Color.Blue);
           g.DrawLine(Mypen, 1, 50, 100, 50);
            Point p1=new Point (50,1);
            Point p2=new Point (50,100);
            g.DrawLine (Mypen ,p1,p2 );
            g.DrawEllipse(Mypen ,30,5,150,150);
            Rectangle rect = new Rectangle(5,20,220,30);
            g.DrawEllipse(Mypen ,rect);
            Rectangle recte = new Rectangle(85, 1, 165, 40);
            g.DrawArc(Mypen ,recte ,0,90);
            Rectangle recta = new Rectangle(85, 1, 165, 40);
            g.DrawPie(Mypen ,recta ,0,90);
        }
    }
}
0 0
原创粉丝点击