c#画图功能

看MSDN时,关键看这句话System.Drawing Namespace命名空间这句话,从这句话开始入手就行了.

The Graphics class provides methods for drawing to the display device. Classes such as Rectangle and Point encapsulate GDI+ primitives. The Pen class is used to draw lines and curves, while classes derived from the abstract class Brush are used to fill the interiors of shapes.

下面一个简单的示例

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace ConsoleApplication7
{
    class Class4
    {
        static void Main(string[] args)
        {
            Image img = new Bitmap(1000, 300);
            Graphics gp= Graphics.FromImage(img);
            Brush bs = new SolidBrush(Color.FromArgb(112,146,190));
            gp.FillRectangle(bs,0,0,1000,300);
            Pen pen=new Pen(Color.Black);
            gp.DrawLine(pen, 150, 250, 150, 20);
            img.Save(@"C:\Users\jim\Desktop\aaaaa\aa.bmp");
        }

    }
}

 

 

 

posted @ 2012-11-25 16:29  wahgon  阅读(278)  评论(0编辑  收藏  举报