資源簡(jiǎn)介
用C#在winform畫(huà)多邊形,圖片可以保存,讀取顯示!

代碼片段和文件信息
using?System;
using?System.Collections;
using?System.Drawing;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Drawing.Imaging;
namespace?DrawPolygon
{
????///?
????///?作者:?WQ
????///?
????public?class?DrawClass
????{
????????public?DrawClass()
????????{?}
????????///?
????????///?在Windows控件兩坐標(biāo)間畫(huà)線
????????///?
????????///?Windows控件
????????///?坐標(biāo)1
????????///?坐標(biāo)2
????????///?線顏色
????????public?static?void?DrawLine(Control?control?Point?pt1?Point?pt2?Color?color)
????????{
????????????Graphics?gfx?=?control.CreateGraphics();
????????????gfx.DrawLine(new?Pen(color)?pt1?pt2);
????????}
????????///?
????????///?在Windows控件坐標(biāo)點(diǎn)畫(huà)十字
????????///?
????????///?Windows控件
????????///?坐標(biāo)
????????///?線顏色
????????public?static?void?DrawCross(Control?control?Point?pt?Color?color)
????????{
????????????Graphics?gfx?=?control.CreateGraphics();
????????????Point?startPt?=?new?Point(pt.X?-?2?pt.Y);
????????????Point?endPt?=?new?Point(pt.X?+?2?pt.Y);
????????????gfx.DrawLine(new?Pen(color)?startPt?endPt);
????????????startPt?=?new?Point(pt.X?pt.Y?-?2);
????????????endPt?=?new?Point(pt.X?pt.Y?+?2);
????????????gfx.DrawLine(new?Pen(color)?startPt?endPt);
????????}
????????///?
????????///?畫(huà)多邊形圖
????????///?
????????///?坐標(biāo)點(diǎn)集合
????????///?圖顏色
????????///?
????????public?static?Bitmap?CreatImage(Point[]?ptsColor?color)
????????{
????????????Bitmap?newBitmap?=?new?Bitmap(600?400?PixelFormat.Format32bppArgb);
????????????Graphics?g?=?Graphics.FromImage(newBitmap);
??????????
????????????g.DrawPolygon(new?Pen(color)?pts);
????????????return?newBitmap;
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????14848??2011-04-24?14:41??DrawPolygon\bin\Debug\DrawPolygon.exe
?????文件??????34304??2011-04-24?14:41??DrawPolygon\bin\Debug\DrawPolygon.pdb
?????文件??????14328??2011-04-24?14:44??DrawPolygon\bin\Debug\DrawPolygon.vshost.exe
?????文件???????5524??2011-04-21?14:18??DrawPolygon\bin\Debug\test.jpg
?????文件???????2156??2011-04-21?14:09??DrawPolygon\DrawClass.cs
?????文件???????3853??2011-04-24?14:41??DrawPolygon\DrawPolygon.csproj
?????文件????????911??2011-04-24?14:21??DrawPolygon\DrawPolygon.sln
????..A..H.?????16384??2011-04-24?14:44??DrawPolygon\DrawPolygon.suo
?????文件???????5452??2011-04-24?14:22??DrawPolygon\frmDrawPolygon.cs
?????文件???????8189??2011-04-24?14:22??DrawPolygon\frmDrawPolygon.Designer.cs
?????文件???????8867??2011-04-24?14:22??DrawPolygon\frmDrawPolygon.resx
?????文件???????1098??2011-04-24?14:44??DrawPolygon\obj\Debug\DrawPolygon.csproj.FileListAbsolute.txt
?????文件????????914??2011-04-24?14:41??DrawPolygon\obj\Debug\DrawPolygon.csproj.GenerateResource.Cache
?????文件??????14848??2011-04-24?14:41??DrawPolygon\obj\Debug\DrawPolygon.exe
?????文件???????2014??2011-04-24?14:41??DrawPolygon\obj\Debug\DrawPolygon.frmDrawPolygon.resources
?????文件??????34304??2011-04-24?14:41??DrawPolygon\obj\Debug\DrawPolygon.pdb
?????文件????????180??2011-04-24?14:41??DrawPolygon\obj\Debug\DrawPolygon.Properties.Resources.resources
?????文件????????501??2011-04-21?11:42??DrawPolygon\Program.cs
?????文件???????1378??2011-04-20?12:40??DrawPolygon\Properties\AssemblyInfo.cs
?????文件???????2872??2011-04-20?12:40??DrawPolygon\Properties\Resources.Designer.cs
?????文件???????5612??2011-04-20?12:40??DrawPolygon\Properties\Resources.resx
?????文件???????1096??2011-04-20?12:40??DrawPolygon\Properties\Settings.Designer.cs
?????文件????????249??2011-04-20?12:40??DrawPolygon\Properties\Settings.settings
?????目錄??????????0??2011-04-22?14:13??DrawPolygon\obj\Debug\Refactor
?????目錄??????????0??2011-04-22?14:13??DrawPolygon\obj\Debug\TempPE
?????目錄??????????0??2011-04-24?14:41??DrawPolygon\bin\Debug
?????目錄??????????0??2011-04-24?14:41??DrawPolygon\obj\Debug
?????目錄??????????0??2011-04-24?14:40??DrawPolygon\bin
?????目錄??????????0??2011-04-22?14:13??DrawPolygon\obj
?????目錄??????????0??2011-04-22?14:13??DrawPolygon\Properties
............此處省略4個(gè)文件信息
評(píng)論
共有 條評(píng)論