C# 绘制矩形(绘制正方形)

Form1.cs 代码:

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DrawRectangle
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Graphics dc = CreateGraphics();
            Show();
            Pen bluePen = new Pen(Color.Blue, 3);
            dc.DrawRectangle(bluePen, 0, 0, 50, 50);
            
        }
    }
}

 

项目例子下载:http://files.cnblogs.com/andrew-blog/DrawRectangle.rar

参考:http://www.wxzzz.com/?id=107

转载于:https://www.cnblogs.com/andrew-blog/archive/2012/06/25/DrawRectangle.html

你可能感兴趣的:(C# 绘制矩形(绘制正方形))