• 大小: 76KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-28
  • 语言: C#
  • 标签: C#  CAD  画图工具  

资源简介

C# CAD 画图工具, 可以创建直线、圆弧、鼠标拖拽、undo\redo

资源截图

代码片段和文件信息

#region Using directives

using System;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Globalization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.Win32;
using System.Security;

#endregion

// Using: in the end of this file.

namespace DocToolkit
{
    #region Class DocManager

    /// 
    /// Document manager. Makes file-related operations:
    /// open new save updating of the form title 
    /// registering of file type for Windows Shell.
    /// Built using the article:
    /// Creating Document-Centric Applications in Windows Forms
    /// by Chris Sells
    /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms09182003.asp
    /// 

    public class DocManager
    {

        #region Events

        public event SaveEventHandler SaveEvent;
        public event LoadEventHandler LoadEvent;
        public event OpenFileEventHandler OpenEvent;
        public event EventHandler ClearEvent;
        public event EventHandler DocChangedEvent;

        #endregion

        #region Members

        private string fileName = ““;
        private bool dirty = false;

        private Form frmOwner;
        private string newDocName;
        private string fileDlgFilter;
        private string registryPath;
        private bool updatetitle;

        private const string registryValue = “Path“;
        private string fileDlgInitDir = ““;         // file dialog initial directory

        #endregion

        #region Enum

        /// 
        /// Enumeration used for Save function
        /// 

        public enum SaveType
        {
            Save
            SaveAs
        }

        #endregion

        #region Constructor

        /// 
        /// Initialization
        /// 

        /// 
        public DocManager(DocManagerData data)
        {
            frmOwner = data.FormOwner;
            frmOwner.Closing += OnClosing;

            updatetitle = data.Updatetitle;

            newDocName = data.NewDocName;

            fileDlgFilter = data.FileDialogFilter;

            registryPath = data.RegistryPath;

            if (!registryPath.EndsWith(“\\“))
                registryPath += “\\“;

            registryPath += “FileDir“;

            // attempt to read initial directory from registry
            RegistryKey key = Registry.CurrentUser.OpenSubKey(registryPath);

            if (key != null)
            {
                string s = (string)key.GetValue(registryValue);

                if (!Empty(s))
                    fileDlgInitDir = s;
            }
        }

        #endregion

        #region Public functions and Properties

        /// 

        /// Dirty property (true when document has unsaved changes).
 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-07-25 03:06  DrawTools-master\
     文件          81  2011-07-25 03:06  DrawTools-master\.gitignore
     目录           0  2011-07-25 03:06  DrawTools-master\DocToolkit\
     文件       28000  2011-07-25 03:06  DrawTools-master\DocToolkit\DocManager.cs
     文件        2191  2011-07-25 03:06  DrawTools-master\DocToolkit\DocToolkit.csproj
     文件        3941  2011-07-25 03:06  DrawTools-master\DocToolkit\DragDropManager.cs
     文件       16590  2011-07-25 03:06  DrawTools-master\DocToolkit\MruManager.cs
     文件        6401  2011-07-25 03:06  DrawTools-master\DocToolkit\PersistWindowState.cs
     目录           0  2011-07-25 03:06  DrawTools-master\DocToolkit\Properties\
     文件        1393  2011-07-25 03:06  DrawTools-master\DocToolkit\Properties\AssemblyInfo.cs
     目录           0  2011-07-25 03:06  DrawTools-master\DrawTools\
     文件         904  2011-07-25 03:06  DrawTools-master\DrawTools\Command.cs
     文件         766  2011-07-25 03:06  DrawTools-master\DrawTools\CommandAdd.cs
     文件        2399  2011-07-25 03:06  DrawTools-master\DrawTools\CommandChangeState.cs
     文件        1639  2011-07-25 03:06  DrawTools-master\DrawTools\CommandDelete.cs
     文件        1245  2011-07-25 03:06  DrawTools-master\DrawTools\CommandDeleteAll.cs
     文件        1761  2011-07-25 03:06  DrawTools-master\DrawTools\DrawArea.Designer.cs
     文件       10241  2011-07-25 03:06  DrawTools-master\DrawTools\DrawArea.cs
     文件        5814  2011-07-25 03:06  DrawTools-master\DrawTools\DrawArea.resx
     文件        1033  2011-07-25 03:06  DrawTools-master\DrawTools\DrawEllipse.cs
     文件        7237  2011-07-25 03:06  DrawTools-master\DrawTools\DrawLine.cs
     文件        9054  2011-07-25 03:06  DrawTools-master\DrawTools\Drawobject.cs
     文件        6625  2011-07-25 03:06  DrawTools-master\DrawTools\DrawPolygon.cs
     文件       10248  2011-07-25 03:06  DrawTools-master\DrawTools\DrawRectangle.cs
     文件        5882  2011-07-25 03:06  DrawTools-master\DrawTools\DrawTools.csproj
     文件        2273  2011-07-25 03:06  DrawTools-master\DrawTools\DrawTriangle.cs
     文件         326  2011-07-25 03:06  DrawTools-master\DrawTools\Ellipse.cur
     文件        3134  2011-07-25 03:06  DrawTools-master\DrawTools\FrmAbout.Designer.cs
     文件         731  2011-07-25 03:06  DrawTools-master\DrawTools\FrmAbout.cs
     文件        7730  2011-07-25 03:06  DrawTools-master\DrawTools\FrmAbout.resx
     文件       14088  2011-07-25 03:06  DrawTools-master\DrawTools\GraphicsList.cs
............此处省略49个文件信息

评论

共有 条评论