资源简介

C# 高仿 Windows 画图板,实现图片的打开/保存/文字绘制/矩形/圆形/椭圆形/圆角矩形/画刷/画笔/喷枪/曲线/取色等功能。

资源截图

代码片段和文件信息

#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  2018-10-17 10:33  DrawToolsRedux-Source\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\.vs\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\.vs\DrawToolsRedux\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\.vs\DrawToolsRedux\v14\
     文件       86528  2018-10-17 10:44  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\.vs\DrawToolsRedux\v14\.suo
     文件       13321  2010-06-23 11:11  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\Article.htm
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\
     文件       28000  2007-01-12 17:46  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\DocManager.cs
     文件        3970  2010-05-10 11:52  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\DocToolkit.csproj
     文件         452  2010-05-10 11:52  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\DocToolkit.csproj.user
     文件        3941  2007-01-12 17:50  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\DragDropManager.cs
     文件       16590  2007-01-12 17:47  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\MruManager.cs
     文件        6401  2007-01-12 17:52  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\PersistWindowState.cs
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\Properties\
     文件        1393  2007-01-12 17:44  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\Properties\AssemblyInfo.cs
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\bin\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\bin\Release\
     文件       19968  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\bin\Release\DocToolkit.dll
     文件       44544  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\bin\Release\DocToolkit.pdb
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\
     目录           0  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\
     文件        6043  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1216  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\DocToolkit.csproj.FileListAbsolute.txt
     文件        1225  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\DocToolkit.csprojResolveAssemblyReference.cache
     文件       19968  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\DocToolkit.dll
     文件       44544  2018-10-17 10:34  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\DocToolkit.pdb
     目录           0  2018-10-17 10:57  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DocToolkit\obj\Release\TempPE\
     目录           0  2018-10-17 10:33  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DrawToolsRedux\
     文件         855  2007-05-29 21:53  DrawToolsRedux-Source\DrawToolsRedux-Source\DrawToolsRedux\DrawToolsRedux\Command.cs
............此处省略153个文件信息

评论

共有 条评论