(C#)GDI+简单绘图画矩形

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 _10._2._4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen pen = new Pen(Color.Tomato, 4);
            g.DrawRectangle(pen, 20, 20, 200, 220);
            Brush brush = new SolidBrush(Color.SpringGreen);
            g.FillRectangle(brush, 230, 20, 200, 220);
        }
    }
}


原文地址:https://www.cnblogs.com/finlay/p/3234760.html