資源簡介
winform寫的仿windows畫圖軟件,鉛筆,橡皮,顏色,粗細,存儲,打開等基本功能。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?畫板
{
????class?DrawTools:Form
????{
????????public?Graphics?DrawTools_Graphics;//目標繪圖板
????????private?Pen?p;
????????private?Image?orginalImg;//原始畫布,用來保存已完成的繪圖過程
????????private?Color?drawColor?=?Color.Black;//繪圖顏色
????????private?Graphics?newgraphics;//中間畫板
????????private?Image?finishingImg;//中間畫布,用來保存繪圖過程中的痕跡
????????private?float?size?=?1;
????????///?
????????///?繪圖顏色
????????///?
????????public?Color?DrawColor
????????{
????????????get?{?return?drawColor;?}
????????????set
????????????{
????????????????drawColor?=?value;
????????????????p.Color?=?value;
????????????}
????????}
????????///?
????????///?繪圖顏色
????????///?
????????public?float?Size
????????{
????????????get?{?return?size;?}
????????????set
????????????{
????????????????size?=?value;
????????????????p.Width?=?value;
????????????}
????????}
????????///?
????????///?原始畫布
????????///?
????????public?Image?OrginalImg
????????{
????????????get?{?return?orginalImg;?}
????????????set
????????????{
????????????????finishingImg?=?(Image)value.Clone();
????????????????orginalImg?=?(Image)value.Clone();
????????????}
????????}
????????///?
????????///?表示是否開始繪圖
????????///?
????????public?bool?startDraw?=?false;
????????///?
????????///?繪圖起點
????????///?
????????public?PointF?startPointF;
????????///?
????????///?初始化繪圖工具
????????///?
????????///?繪圖板
????????///?繪圖顏色
????????///?初始畫布
????????public?DrawTools(Graphics?g?Color?c?Image?img)
????????{
????????????DrawTools_Graphics?=?g;
????????????drawColor?=?c;
????????????p?=?new?Pen(c?1);
????????????finishingImg?=?(Image)img.Clone();
????????????orginalImg?=?(Image)img.Clone();
????????}
????????///?
????????///?橡皮方法
????????///?
????????///?鼠標參數
????????public?void?Eraser(MouseEventArgs?e)
????????{
????????????if?(startDraw)
????????????{
????????????????newgraphics?=?Graphics.FromImage(finishingImg);
????????????????newgraphics.FillRectangle(new?SolidBrush(Color.White)?e.X?e.Y?20?20);
????????????????newgraphics.Dispose();
????????????????DrawTools_Graphics.DrawImage(finishingImg?0?0);
????????????}
????????}
????????///?
????????///?鉛筆方法
????????///?
????????///?鼠標參數
????????public?void?DrawDot(MouseEventArgs?e)
????????{
????????????if?(startDraw)
????????????{
????????????????newgraphics?=?Graphics.FromImage(finishingImg);
????????????????PointF?currentPointF?=?new?PointF(e.X?e.Y);
????????????????newgraphics.DrawLine(p?startPointF?currentPointF);
????????????????startPointF?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????48128??2017-10-10?18:28??畫板?-?副本?-?副本\.vs\畫板\v14\.suo
?????文件????????189??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\App.config
?????文件?????????82??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\Circle.gif
?????文件????????714??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\eraser.png
?????文件????????851??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\FillCircle.GIF
?????文件????????851??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\Fillrect.GIF
?????文件?????????73??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\line.gif
?????文件????????766??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\pb.cur
?????文件????????311??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\Pencil.gif
?????文件?????????81??2017-10-10?17:39??畫板?-?副本?-?副本\畫板\bin\Debug\img\rect.gif
?????文件??????17920??2017-10-10?18:14??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.exe
?????文件????????189??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.exe.config
?????文件??????36352??2017-10-10?18:14??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.pdb
?????文件??????22696??2017-10-10?18:29??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.vshost.exe
?????文件????????189??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.vshost.exe.config
?????文件????????490??2015-10-30?15:19??畫板?-?副本?-?副本\畫板\bin\Debug\畫板.vshost.exe.manifest
?????文件???????4009??2017-10-10?17:47??畫板?-?副本?-?副本\畫板\DrawTools.cs
?????文件??????11154??2017-10-10?18:28??畫板?-?副本?-?副本\畫板\Form1.cs
?????文件??????15126??2017-10-10?18:28??畫板?-?副本?-?副本\畫板\Form1.Designer.cs
?????文件???????5817??2017-10-10?18:28??畫板?-?副本?-?副本\畫板\Form1.resx
?????文件???????1464??2017-10-09?18:08??畫板?-?副本?-?副本\畫板\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7946??2017-10-10?18:11??畫板?-?副本?-?副本\畫板\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2017-10-08?17:41??畫板?-?副本?-?副本\畫板\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件???????1875??2017-10-10?18:29??畫板?-?副本?-?副本\畫板\obj\Debug\畫板.csproj.FileListAbsolute.txt
?????文件???????1012??2017-10-10?18:14??畫板?-?副本?-?副本\畫板\obj\Debug\畫板.csproj.GenerateResource.Cache
?????文件???????2384??2017-10-10?18:12??畫板?-?副本?-?副本\畫板\obj\Debug\畫板.csprojResolveAssemblyReference.cache
?????文件??????17920??2017-10-10?18:14??畫板?-?副本?-?副本\畫板\obj\Debug\畫板.exe
?????文件????????180??2017-10-10?18:14??畫板?-?副本?-?副本\畫板\obj\Debug\畫板.Form1.resources
............此處省略26個文件信息
- 上一篇:C# 串口通信原理
- 下一篇:C#(VS2017)百度語音識別demo
評論
共有 條評論