代码改变世界

SharpMap实践代码

2013-01-09 23:04  hongjiumu  阅读(348)  评论(0编辑  收藏  举报

SharpMap实践代码
http://download.csdn.net/download/studyforgis/3327777
http://www.cnblogs.com/sharpfeng/archive/2011/06/08/2075553.html

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Initialize();
        }
 
        private void Initialize()
        {
            System.Drawing.Image image
                = new System.Drawing.Bitmap(400,300);
            System.Drawing.Graphics graphics
                = System.Drawing.Graphics.FromImage(image);
 
            System.Drawing.Brush brush
                = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(120,
                        System.Drawing.Color.Green
                    ));
            System.Drawing.Drawing2D.GraphicsPath graphicsPath
                = new System.Drawing.Drawing2D.GraphicsPath();
            System.Drawing.PointF[] pa = {
                                             new System.Drawing.PointF(123,12),
                                             new System.Drawing.PointF(34,45),
                                             new System.Drawing.PointF(99,34),
                                             new System.Drawing.PointF(100,100),
                                             new System.Drawing.PointF(200,300),
                                             new System.Drawing.PointF(300,200)
                                         };
            graphicsPath.AddPolygon(pa);
 
            graphics.FillPath(brush,graphicsPath);
 
            this.pictureBox1.Image = image;
            //graphics.Dispose();
 
        }
 
    }
}