• 大小: 81KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: 其他
  • 标签: C#  

资源简介

Windows画板实例源码,绝对可完美运行,带有文字注释,欢迎下载!!!

资源截图

代码片段和文件信息

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

namespace PictureBoard4.Shape
{
   public class DrawTool
    {
       //绘制白色底片
       public static void BackColor(Shape Shape Graphics g) 
       {
           //坐标
           Point StartPoint = new Point();
           Point EndPoint = new Point();
           if(Shape.GetBound(ref StartPointref EndPoint))
           {
               Pen p = new Pen(Color.Blue 2);
               //绘制虚线
               p.Dashstyle = System.Drawing.Drawing2D.Dashstyle.DashDot;
               if (StartPoint.X > EndPoint.X)
               {
                   g.FillRectangle(new SolidBrush(Color.White) new Rectangle(EndPoint.X EndPoint.Y Math.Abs(StartPoint.X - EndPoint.X) Math.Abs(StartPoint.Y - EndPoint.Y)));
               }
               else 
               {
                   g.FillRectangle(new SolidBrush(Color.White) new Rectangle(StartPoint.X StartPoint.Y Math.Abs(StartPoint.X - EndPoint.X) Math.Abs(StartPoint.Y - EndPoint.Y)));
               }
           }
       }
       //绘制边框
       public static void DrawBoard(Shape shape Graphics g) 
       {
           //坐标
           Point StartPoint = new Point();
           Point EndPoint = new Point();
           //矩形边框
           if (shape.GetBound(ref StartPoint ref EndPoint))
           {
               Pen p = new Pen(Color.Blue 2);
               p.Dashstyle = System.Drawing.Drawing2D.Dashstyle.DashDot;
               int realStartX = Math.Min(StartPoint.X EndPoint.X);
               int realStartY = Math.Min(StartPoint.Y EndPoint.Y);
               int realEndX = Math.Max(StartPoint.X EndPoint.X);
               int realEndY = Math.Max(StartPoint.Y EndPoint.Y);
               int minStartX = StartPoint.X minStartY = StartPoint.Y maxEndX = 0 maxEndY = 0;
               minStartX = Math.Min(minStartX realStartX);
               minStartY = Math.Min(minStartY realStartY);
               maxEndX = Math.Max(maxEndX realEndX);
               maxEndY = Math.Max(maxEndY realEndY);
               //以下是为了获取最大重绘矩形。
               Rectangle refeshRect = new Rectangle(minStartX minStartY maxEndX - minStartX maxEndY - minStartY);
               refeshRect.Inflate(1 1);//重绘矩形的大小扩展1个单位
               g.DrawRectangle(p refeshRect);
           }
       }
       //得到边界
       public static bool IsBound(Shape Shape Point TempPoint)
       {
           //得到坐标
           Point StartPoint = new Point();
           Point EndPoint = new Point();

           if (Shape.GetBound(ref StartPoint ref EndPoint))
           {
               if (Math.Abs(StartPoint.X - EndPoint.X)
                   == Math.Abs(TempPoint.X - StartPoint.X)
                   + Math.Abs(TempPoint.X - EndPoint.X))
               {
                   if (Math.Abs(StartPoint.Y - EndPoint.Y)
                   == Math.Abs(TempPoint.Y - StartPoint.Y)
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        507  2016-09-19 09:15  瞅我,来来看我.txt

     文件      25088  2014-05-13 16:31  QSWindowsPaint\bin\Debug\PictureBoard4.exe

     文件      85504  2014-05-13 16:31  QSWindowsPaint\bin\Debug\PictureBoard4.pdb

     文件      11600  2014-05-13 16:42  QSWindowsPaint\bin\Debug\PictureBoard4.vshost.exe

     文件        490  2010-03-17 22:39  QSWindowsPaint\bin\Debug\PictureBoard4.vshost.exe.manifest

     文件       5411  2014-03-16 08:57  QSWindowsPaint\ClassDiagram1.cd

     文件       3358  2014-03-12 09:12  QSWindowsPaint\DrawTool.cs

     文件       1015  2014-03-21 10:31  QSWindowsPaint\FactoryShape.cs

     文件       5958  2014-03-21 12:06  QSWindowsPaint\Frm1.cs

     文件      13049  2014-03-19 08:40  QSWindowsPaint\Frm1.Designer.cs

     文件       6792  2014-03-19 08:40  QSWindowsPaint\Frm1.resx

     文件       4714  2014-03-19 10:28  QSWindowsPaint\ManageDraw.cs

     文件       5359  2014-05-10 09:52  QSWindowsPaint\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6511  2014-05-13 16:31  QSWindowsPaint\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1986  2014-05-13 16:42  QSWindowsPaint\obj\x86\Debug\PictureBoard4.csproj.FileListAbsolute.txt

     文件        974  2014-05-10 09:53  QSWindowsPaint\obj\x86\Debug\PictureBoard4.csproj.GenerateResource.Cache

     文件       9040  2014-05-10 09:53  QSWindowsPaint\obj\x86\Debug\PictureBoard4.csprojResolveAssemblyReference.cache

     文件      25088  2014-05-13 16:31  QSWindowsPaint\obj\x86\Debug\PictureBoard4.exe

     文件        180  2014-03-21 09:05  QSWindowsPaint\obj\x86\Debug\PictureBoard4.Frm1.resources

     文件      85504  2014-05-13 16:31  QSWindowsPaint\obj\x86\Debug\PictureBoard4.pdb

     文件        180  2014-03-21 09:05  QSWindowsPaint\obj\x86\Debug\PictureBoard4.Properties.Resources.resources

     文件       4306  2014-03-21 09:05  QSWindowsPaint\PictureBoard4.csproj

     文件        867  2014-05-13 16:34  QSWindowsPaint\PictureBoard4.sln

     文件        493  2014-03-11 11:34  QSWindowsPaint\Program.cs

     文件       1394  2014-05-15 10:03  QSWindowsPaint\Properties\AssemblyInfo.cs

     文件       2877  2014-03-11 11:32  QSWindowsPaint\Properties\Resources.Designer.cs

     文件       5612  2014-03-11 11:32  QSWindowsPaint\Properties\Resources.resx

     文件       1099  2014-03-11 11:32  QSWindowsPaint\Properties\Settings.Designer.cs

     文件        249  2014-03-11 11:32  QSWindowsPaint\Properties\Settings.settings

     文件       2060  2014-03-15 21:52  QSWindowsPaint\Shapes\CarveImage.cs

............此处省略25个文件信息

评论

共有 条评论