├── .gitignore
├── AutoCAD .net开发人员手册中文版.chm
├── CADPlot
├── CADPlot.sln
├── CADPlot.sln.DotSettings
├── CADPlot.vsmdi
├── CADPlot
│ ├── App.config
│ ├── AppConfig.cs
│ ├── CADPlot.csproj
│ ├── CountForm.Designer.cs
│ ├── CountForm.cs
│ ├── CountForm.resx
│ ├── Form1.resx
│ ├── Interop.AutoCAD.dll
│ ├── Moudle
│ │ ├── AutoCADConnector.cs
│ │ ├── CADPaper.cs
│ │ ├── CADPaperSizeDict.cs
│ │ ├── CadPaperToPrint.cs
│ │ ├── CadPapers(冲突_bluebird-workpc_2013-12-07 15-37-16).cs
│ │ └── CadPapers.cs
│ ├── OptionsDialog.Designer.cs
│ ├── OptionsDialog.cs
│ ├── OptionsDialog.resx
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Resources
│ │ ├── Print.png
│ │ ├── add.ico
│ │ ├── addtoprint.png
│ │ ├── admintools.ico
│ │ ├── books.ico
│ │ ├── file.png
│ │ ├── filter.ico
│ │ ├── money.ico
│ │ ├── open.ico
│ │ ├── open.png
│ │ ├── opened.ico
│ │ ├── pin_blue.ico
│ │ ├── pin_green.ico
│ │ ├── printer.ico
│ │ └── set.ico
│ ├── favicon.ico
│ ├── frmShow.Designer.cs
│ ├── frmShow.cs
│ └── frmShow.resx
└── TestProject1
│ ├── App.config
│ ├── AppConfigTest.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── TestProject1.csproj
├── README.md
└── acadauto.chm
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Rr]elease/
19 | x64/
20 | *_i.c
21 | *_p.c
22 | *.ilk
23 | *.meta
24 | *.obj
25 | *.pch
26 | *.pdb
27 | *.pgc
28 | *.pgd
29 | *.rsp
30 | *.sbr
31 | *.tlb
32 | *.tli
33 | *.tlh
34 | *.tmp
35 | *.log
36 | *.vspscc
37 | *.vssscc
38 | .builds
39 |
40 | # Visual C++ cache files
41 | ipch/
42 | *.aps
43 | *.ncb
44 | *.opensdf
45 | *.sdf
46 |
47 | # Visual Studio profiler
48 | *.psess
49 | *.vsp
50 | *.vspx
51 |
52 | # Guidance Automation Toolkit
53 | *.gpState
54 |
55 | # ReSharper is a .NET coding add-in
56 | _ReSharper*
57 |
58 | # NCrunch
59 | *.ncrunch*
60 | .*crunch*.local.xml
61 |
62 | # Installshield output folder
63 | [Ee]xpress
64 |
65 | # DocProject is a documentation generator add-in
66 | DocProject/buildhelp/
67 | DocProject/Help/*.HxT
68 | DocProject/Help/*.HxC
69 | DocProject/Help/*.hhc
70 | DocProject/Help/*.hhk
71 | DocProject/Help/*.hhp
72 | DocProject/Help/Html2
73 | DocProject/Help/html
74 |
75 | # Click-Once directory
76 | publish
77 |
78 | # Publish Web Output
79 | *.Publish.xml
80 |
81 | # NuGet Packages Directory
82 | packages
83 |
84 | # Windows Azure Build Output
85 | csx
86 | *.build.csdef
87 |
88 | # Windows Store app package directory
89 | AppPackages/
90 |
91 | # Others
92 | [Bb]in
93 | [Oo]bj
94 | sql
95 | TestResults
96 | [Tt]est[Rr]esult*
97 | *.Cache
98 | ClientBin
99 | [Ss]tyle[Cc]op.*
100 | ~$*
101 | *.dbmdl
102 | Generated_Code #added for RIA/Silverlight projects
103 |
104 | # Backup & report files from converting an old project file to a newer
105 | # Visual Studio version. Backup files are not needed, because we have git ;-)
106 | _UpgradeReport_Files/
107 | Backup*/
108 | UpgradeLog*.XML
109 |
--------------------------------------------------------------------------------
/AutoCAD .net开发人员手册中文版.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/AutoCAD .net开发人员手册中文版.chm
--------------------------------------------------------------------------------
/CADPlot/CADPlot.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CADPlot", "CADPlot\CADPlot.csproj", "{C67AA93B-2685-4274-A36B-42B469FC6583}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject1", "TestProject1\TestProject1.csproj", "{02AFE1EC-F493-4014-AAA8-E7A515DB79AA}"
7 | EndProject
8 | Global
9 | GlobalSection(TestCaseManagementSettings) = postSolution
10 | CategoryFile = CADPlot1.vsmdi
11 | EndGlobalSection
12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
13 | Debug|Any CPU = Debug|Any CPU
14 | Debug|Mixed Platforms = Debug|Mixed Platforms
15 | Debug|x86 = Debug|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|Mixed Platforms = Release|Mixed Platforms
18 | Release|x86 = Release|x86
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Debug|Any CPU.ActiveCfg = Debug|x86
22 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
23 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Debug|Mixed Platforms.Build.0 = Debug|x86
24 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Debug|x86.ActiveCfg = Debug|x86
25 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Debug|x86.Build.0 = Debug|x86
26 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Release|Any CPU.ActiveCfg = Release|x86
27 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Release|Mixed Platforms.ActiveCfg = Release|x86
28 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Release|Mixed Platforms.Build.0 = Release|x86
29 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Release|x86.ActiveCfg = Release|x86
30 | {C67AA93B-2685-4274-A36B-42B469FC6583}.Release|x86.Build.0 = Release|x86
31 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
34 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
35 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Debug|x86.ActiveCfg = Debug|Any CPU
36 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
37 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Release|Any CPU.Build.0 = Release|Any CPU
38 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
39 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
40 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}.Release|x86.ActiveCfg = Release|Any CPU
41 | EndGlobalSection
42 | GlobalSection(SolutionProperties) = preSolution
43 | HideSolutionNode = FALSE
44 | EndGlobalSection
45 | EndGlobal
46 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
--------------------------------------------------------------------------------
/CADPlot/CADPlot.vsmdi:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/AppConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 |
5 | namespace CADPlot
6 | {
7 | public sealed class AppConfig
8 | {
9 | private static readonly Configuration Config =
10 | ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
11 |
12 | static AppConfig()
13 | {
14 | //#if(DEBUG)
15 | Console.WriteLine(@"配置文件路径:{0}", FilePath);
16 | //#endif
17 | }
18 |
19 | public static Dictionary CadPapreConfigDictionary
20 | {
21 | get { return GetOptionItemsDictionary(); }
22 | }
23 |
24 | public static string FilePath
25 | {
26 | get { return Config.FilePath; }
27 | }
28 |
29 | private static Dictionary GetOptionItemsDictionary()
30 | {
31 | try
32 | {
33 | //Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
34 | ConfigurationManager.RefreshSection("CadDrawingConfig");
35 | var cadDrawingConfig = Config.GetSection("CadDrawingConfig") as CadDrawingConfigSection;
36 | if (cadDrawingConfig == null) return null;
37 | var optionDic = new Dictionary();
38 | foreach (CadDrawingConfigElement item in cadDrawingConfig.CadDrawings)
39 | {
40 | optionDic[item.Name] = item;
41 | }
42 | return optionDic;
43 | }
44 | catch (Exception)
45 | {
46 | return null;
47 | }
48 | }
49 |
50 | public static void Save()
51 | {
52 | Config.Save(ConfigurationSaveMode.Modified);
53 | }
54 | }
55 |
56 | public class CadDrawingConfigSection : ConfigurationSection
57 | {
58 | [ConfigurationProperty("caddrawings")]
59 | public CadDrawingConfigElementCollection CadDrawings
60 | {
61 | get { return this["caddrawings"] as CadDrawingConfigElementCollection; }
62 | set { this["caddrawings"] = value; }
63 | }
64 | }
65 |
66 | ///
67 | /// dwg图纸配置元素
68 | ///
69 | public class CadDrawingConfigElement : ConfigurationElement
70 | {
71 | [ConfigurationProperty("name", IsKey = true, IsRequired = true)]
72 | public string Name
73 | {
74 | get { return this["name"].ToString(); }
75 | set { this["name"] = value; }
76 | }
77 |
78 | [ConfigurationProperty("printer", DefaultValue = "", IsRequired = true)]
79 | public string Printer
80 | {
81 | get { return this["printer"].ToString(); }
82 | set { this["printer"] = value; }
83 | }
84 |
85 | [ConfigurationProperty("canonicalmediaName", DefaultValue = "", IsRequired = true)]
86 | public string CanonicalMediaName
87 | {
88 | get { return this["canonicalmediaName"].ToString(); }
89 | set { this["canonicalmediaName"] = value; }
90 | }
91 |
92 | [ConfigurationProperty("LocaleMediaName", DefaultValue = "", IsRequired = true)]
93 | public string LocaleMediaName
94 | {
95 | get { return this["LocaleMediaName"].ToString(); }
96 | set { this["LocaleMediaName"] = value; }
97 | }
98 | [ConfigurationProperty("fora4", DefaultValue = "", IsRequired = true)]
99 | public string ForA4
100 | {
101 | get { return this["fora4"].ToString(); }
102 | set { this["fora4"] = value; }
103 | }
104 |
105 | [ConfigurationProperty("papersize", DefaultValue = "", IsRequired = true)]
106 | public string PaperSize
107 | {
108 | get { return this["papersize"].ToString(); }
109 | set { this["papersize"] = value; }
110 | }
111 |
112 | [ConfigurationProperty("stylesheet", DefaultValue = "", IsRequired = true)]
113 | public string StyleSheet
114 | {
115 | get { return this["stylesheet"].ToString(); }
116 | set { this["stylesheet"] = value; }
117 | }
118 | }
119 |
120 | public class CadDrawingConfigElementCollection : ConfigurationElementCollection
121 | {
122 | public new CadDrawingConfigElement this[string name]
123 | {
124 | get { return BaseGet(name) as CadDrawingConfigElement; }
125 | }
126 |
127 | protected override ConfigurationElement CreateNewElement()
128 | {
129 | return new CadDrawingConfigElement();
130 | }
131 |
132 | protected override object GetElementKey(ConfigurationElement element)
133 | {
134 | return ((CadDrawingConfigElement) element).Name;
135 | }
136 | }
137 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/CADPlot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {C67AA93B-2685-4274-A36B-42B469FC6583}
9 | WinExe
10 | Properties
11 | CADPlot
12 | CADPlot
13 | v4.0
14 | Client
15 | 512
16 | false
17 | C:\Documents and Settings\Administrator\桌面\
18 | true
19 | Disk
20 | false
21 | Foreground
22 | 7
23 | Days
24 | false
25 | false
26 | true
27 | 1
28 | 1.0.0.%2a
29 | false
30 | true
31 | true
32 | Relative
33 |
34 |
35 | x86
36 | true
37 | full
38 | false
39 | bin\Debug\
40 | DEBUG;TRACE
41 | prompt
42 | 4
43 |
44 |
45 | x86
46 | pdbonly
47 | true
48 | bin\Release\
49 | TRACE
50 | prompt
51 | 4
52 |
53 |
54 | 6FB35EE5FB2CCC8F09015DBFAB0B7D7F937A4F56
55 |
56 |
57 | CADPlot_TemporaryKey.pfx
58 |
59 |
60 | true
61 |
62 |
63 | true
64 |
65 |
66 | CADPlot.Program
67 |
68 |
69 | favicon.ico
70 |
71 |
72 |
73 |
74 | False
75 | False
76 | .\Interop.AutoCAD.dll
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 | Form
90 |
91 |
92 | CountForm.cs
93 |
94 |
95 |
96 |
97 | Form
98 |
99 |
100 | frmShow.cs
101 |
102 |
103 |
104 |
105 | Form
106 |
107 |
108 | OptionsDialog.cs
109 |
110 |
111 |
112 |
113 | CountForm.cs
114 |
115 |
116 | frmShow.cs
117 |
118 |
119 | OptionsDialog.cs
120 |
121 |
122 | ResXFileCodeGenerator
123 | Resources.Designer.cs
124 | PreserveNewest
125 | Designer
126 |
127 |
128 | True
129 | Resources.resx
130 | True
131 | PreserveNewest
132 |
133 |
134 | PreserveNewest
135 | Designer
136 |
137 |
138 |
139 |
140 | False
141 | Microsoft .NET Framework 4 Client Profile %28x86 和 x64%29
142 | true
143 |
144 |
145 | False
146 | .NET Framework 3.5 SP1 Client Profile
147 | false
148 |
149 |
150 | False
151 | .NET Framework 3.5 SP1
152 | false
153 |
154 |
155 | False
156 | Windows Installer 3.1
157 | true
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
185 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/CountForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CADPlot
2 | {
3 | partial class CountForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lsvShowCountDate = new System.Windows.Forms.ListView();
32 | this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.btClose = new System.Windows.Forms.Button();
36 | this.SuspendLayout();
37 | //
38 | // lsvShowCountDate
39 | //
40 | this.lsvShowCountDate.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
41 | this.columnHeader1,
42 | this.columnHeader2,
43 | this.columnHeader3});
44 | this.lsvShowCountDate.Location = new System.Drawing.Point(9, 10);
45 | this.lsvShowCountDate.Name = "lsvShowCountDate";
46 | this.lsvShowCountDate.Size = new System.Drawing.Size(271, 195);
47 | this.lsvShowCountDate.TabIndex = 0;
48 | this.lsvShowCountDate.UseCompatibleStateImageBehavior = false;
49 | this.lsvShowCountDate.View = System.Windows.Forms.View.Details;
50 | //
51 | // columnHeader1
52 | //
53 | this.columnHeader1.Text = "图幅";
54 | this.columnHeader1.Width = 67;
55 | //
56 | // columnHeader2
57 | //
58 | this.columnHeader2.Text = "自然张数";
59 | this.columnHeader2.Width = 83;
60 | //
61 | // columnHeader3
62 | //
63 | this.columnHeader3.Text = "折合A4";
64 | this.columnHeader3.Width = 78;
65 | //
66 | // btClose
67 | //
68 | this.btClose.Location = new System.Drawing.Point(106, 211);
69 | this.btClose.Name = "btClose";
70 | this.btClose.Size = new System.Drawing.Size(73, 29);
71 | this.btClose.TabIndex = 1;
72 | this.btClose.Text = "关闭";
73 | this.btClose.UseVisualStyleBackColor = true;
74 | this.btClose.Click += new System.EventHandler(this.btClose_Click);
75 | //
76 | // CountForm
77 | //
78 | this.AcceptButton = this.btClose;
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.CancelButton = this.btClose;
82 | this.ClientSize = new System.Drawing.Size(288, 244);
83 | this.Controls.Add(this.btClose);
84 | this.Controls.Add(this.lsvShowCountDate);
85 | this.MaximizeBox = false;
86 | this.MinimizeBox = false;
87 | this.Name = "CountForm";
88 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
89 | this.Text = "图纸打印数量统计";
90 | this.ResumeLayout(false);
91 |
92 | }
93 |
94 | #endregion
95 |
96 | private System.Windows.Forms.ListView lsvShowCountDate;
97 | private System.Windows.Forms.ColumnHeader columnHeader1;
98 | private System.Windows.Forms.ColumnHeader columnHeader2;
99 | private System.Windows.Forms.ColumnHeader columnHeader3;
100 | private System.Windows.Forms.Button btClose;
101 | }
102 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/CountForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Forms;
4 | using CADPlot.Moudle;
5 |
6 | namespace CADPlot
7 | {
8 | public partial class CountForm : Form
9 | {
10 | public CountForm(CadPaperForPrinting papers)
11 | {
12 | InitializeComponent();
13 | if (papers != null)
14 | {
15 |
16 | ListViewItem item = lsvShowCountDate.Items.Add("A0");
17 | item.SubItems.AddRange(new[]
18 | {
19 | papers.A0S.NatureCount.ToString(CultureInfo.InvariantCulture),
20 | papers.A0S.ForA4Count.ToString(CultureInfo.InvariantCulture)
21 | });
22 | item = lsvShowCountDate.Items.Add("A1");
23 | item.SubItems.AddRange(new[]
24 | {
25 | papers.A1S.NatureCount.ToString(CultureInfo.InvariantCulture),
26 | papers.A1S.ForA4Count.ToString(CultureInfo.InvariantCulture)
27 | });
28 | item = lsvShowCountDate.Items.Add("A2");
29 | item.SubItems.AddRange(new[]
30 | {
31 | papers.A2S.NatureCount.ToString(CultureInfo.InvariantCulture),
32 | papers.A2S.ForA4Count.ToString(CultureInfo.InvariantCulture)
33 | });
34 | item = lsvShowCountDate.Items.Add("A3");
35 | item.SubItems.AddRange(new[]
36 | {
37 | papers.A3S.NatureCount.ToString(CultureInfo.InvariantCulture),
38 | papers.A3S.ForA4Count.ToString(CultureInfo.InvariantCulture)
39 | });
40 | item = lsvShowCountDate.Items.Add("A4");
41 | item.SubItems.AddRange(new[]
42 | {
43 | papers.A4S.NatureCount.ToString(CultureInfo.InvariantCulture),
44 | papers.A4S.ForA4Count.ToString(CultureInfo.InvariantCulture)
45 | });
46 | item = lsvShowCountDate.Items.Add("A43");
47 | item.SubItems.AddRange(new[]
48 | {
49 | papers.A43S.NatureCount.ToString(CultureInfo.InvariantCulture),
50 | papers.A43S.ForA4Count.ToString(CultureInfo.InvariantCulture)
51 | });
52 | item = lsvShowCountDate.Items.Add("A44");
53 | item.SubItems.AddRange(new[]
54 | {
55 | papers.A44S.NatureCount.ToString(CultureInfo.InvariantCulture),
56 | papers.A44S.ForA4Count.ToString(CultureInfo.InvariantCulture)
57 | });
58 | item = lsvShowCountDate.Items.Add("A33");
59 | item.SubItems.AddRange(new[]
60 | {
61 | papers.A33S.NatureCount.ToString(CultureInfo.InvariantCulture),
62 | papers.A33S.ForA4Count.ToString(CultureInfo.InvariantCulture)
63 | });
64 | item = lsvShowCountDate.Items.Add("A34");
65 | item.SubItems.AddRange(new[]
66 | {
67 | papers.A34S.NatureCount.ToString(CultureInfo.InvariantCulture),
68 | papers.A34S.ForA4Count.ToString(CultureInfo.InvariantCulture)
69 | });
70 | item = lsvShowCountDate.Items.Add("其它");
71 | item.SubItems.AddRange(new[]
72 | {
73 | papers.OtherSizePapers.NatureCount.ToString(CultureInfo.InvariantCulture),
74 | papers.OtherSizePapers.ForA4Count.ToString(CultureInfo.InvariantCulture)
75 | });
76 |
77 | item = lsvShowCountDate.Items.Add("合计");
78 | item.SubItems.AddRange(new[]
79 | {
80 | papers.NatureCount.ToString(CultureInfo.InvariantCulture),
81 | papers.ForA4Count.ToString(CultureInfo.InvariantCulture)
82 | });
83 |
84 | }
85 | }
86 |
87 | private void btClose_Click(object sender, EventArgs e)
88 | {
89 | Close();
90 | }
91 | }
92 | }
93 |
94 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/CountForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
124 | True
125 |
126 |
127 | True
128 |
129 |
130 | True
131 |
132 |
133 | True
134 |
135 |
136 | True
137 |
138 |
139 | True
140 |
141 |
142 | 17, 17
143 |
144 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Interop.AutoCAD.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Interop.AutoCAD.dll
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/AutoCADConnector.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Moudle/AutoCADConnector.cs
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/CADPaper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Configuration;
6 | using System.Windows.Forms;
7 | using AutoCAD;
8 |
9 | namespace CADPlot.Moudle
10 | {
11 | public class CadPaper
12 | {
13 | ///
14 | /// 存放dwg图纸尺寸对应的图幅名称
15 | ///
16 | private readonly IDictionary PaperSizeDic;
17 | public static readonly Dictionary PaperNameDictionary = new Dictionary
18 | {
19 | {"ALL", "所有图纸"},
20 | {"A4", "A4"},
21 | {"A3", "A3"},
22 | {"A2", "A2"},
23 | {"A1", "A1"},
24 | {"A0", "A0"},
25 | {"A43", "A4×3"},
26 | {"A44", "A4×4"},
27 | {"A33", "A3×3"},
28 | {"A34", "A3×4"},
29 | {"OTHER", "其它"},
30 | };
31 |
32 | public CadPaper()
33 | {
34 | //读取配置文件,将配置中的图纸尺寸与图幅名称对应
35 | PaperSizeDic = new Dictionary();
36 | Dictionary.ValueCollection items =
37 | AppConfig.CadPapreConfigDictionary.Values;
38 | foreach (CadDrawingConfigElement item in items)
39 | {
40 | string size = item.PaperSize;
41 | string[] s = size.Split(Convert.ToChar("*"));
42 | PaperSizeDic[string.Format("{0}*{1}", s[0], s[1])] = item.Name;
43 | PaperSizeDic[string.Format("{0}*{1}", s[1], s[0])] = item.Name;
44 | }
45 | }
46 |
47 | [DisplayName(@"已打印")]
48 | public bool IsPrinted
49 | {
50 | get { return PrintedNum > 0; }
51 | }
52 |
53 | [DisplayName(@"文件路径")]
54 | public string FileFullName { get; set; }
55 |
56 | [DisplayName(@"图幅")]
57 | public string MapSheet
58 | {
59 | get
60 | {
61 | if (Width == 0 || Height == 0)
62 | return "OTHER";
63 | try
64 | {
65 | return PaperSizeDic.ContainsKey(string.Format("{0}*{1}", Width, Height))
66 | ? PaperSizeDic[string.Format("{0}*{1}", Width, Height)]
67 | : "OTHER";
68 | }
69 | catch (Exception)
70 | {
71 | return "OTHER";
72 | }
73 | }
74 | }
75 |
76 | [DisplayName(@"文件名")]
77 | public string FileShortName
78 | {
79 | get
80 | {
81 | return !string.IsNullOrWhiteSpace(FileFullName)
82 | ? FileFullName.Substring(FileFullName.LastIndexOf("\\", StringComparison.Ordinal) + 1)
83 | : "";
84 | }
85 | }
86 |
87 | [DisplayName(@"比例")]
88 | public double Scale { get; set; }
89 |
90 | [DisplayName(@"角度")]
91 | public int Angle { get; set; }
92 |
93 | [DisplayName(@"已打印")]
94 | public int PrintedNum { get; set; }
95 |
96 | [DisplayName(@"宽度")]
97 | public int Width { get; set; }
98 |
99 | [DisplayName(@"高度")]
100 | public int Height { get; set; }
101 |
102 | [DisplayName(@"折合A4")]
103 | public int ForA4
104 | {
105 | //get { return ForA4Dic[FormatName.ToUpper()]; }
106 | get { return int.Parse(AppConfig.CadPapreConfigDictionary[MapSheet].ForA4); }
107 | }
108 |
109 | [DisplayName(@"打印机")]
110 | public string PlotConfigName
111 | {
112 | get { return AppConfig.CadPapreConfigDictionary[MapSheet].Printer; }
113 | }
114 |
115 | [DisplayName(@"打印尺寸")]
116 | public string CanonicalMediaName
117 | {
118 | get { return AppConfig.CadPapreConfigDictionary[MapSheet].CanonicalMediaName; }
119 | }
120 |
121 | [DisplayName(@"图纸尺寸")]
122 | public string LocalCanonicalMediaName
123 | {
124 | get { return AppConfig.CadPapreConfigDictionary[MapSheet].LocaleMediaName; }
125 |
126 | }
127 |
128 | [DisplayName(@"打印样式")]
129 | public string StyleSheet
130 | {
131 | get { return AppConfig.CadPapreConfigDictionary[MapSheet].StyleSheet; }
132 | }
133 |
134 | public void Print()
135 | {
136 | using (var cad = new AutoCadConnector())
137 | {
138 | try
139 | {
140 | AcadDocument doc = cad.Application.Documents.Open(FileFullName);
141 | AcadLayout layout = doc.ModelSpace.Layout;
142 |
143 | #region Autocad.Layout对象的属性及方法,主要用于打印输出
144 |
145 | //Application
146 | //Block
147 | //CanonicalMediaName
148 | //CenterPlot
149 | //ConfigName
150 | //Document
151 | //GetCanonicalMediaNames
152 | //GetLocaleMediaName
153 | //GetPlotDeviceNames
154 | //GetPlotStyleTableNames
155 | //Handle
156 | //HasExtensionDictionary
157 | //ModelType
158 | //Name
159 | //ObjectID
160 | //ObjectName
161 | //OwnerID
162 | //PaperUnits
163 | //PlotHidden
164 | //PlotOrigin
165 | //PlotRotation
166 | //PlotType
167 | //PlotViewportBorders
168 | //PlotViewportsFirst
169 | //PlotWithLineweights
170 | //PlotWithPlotStyles
171 | //RefreshPlotDeviceInfo
172 | //ScaleLineweights
173 | //ShowPlotStyles
174 | //StandardScale
175 | //StyleSheet
176 | //TabOrder
177 | //UseStandardScale
178 | //ViewToPlot
179 |
180 | #endregion
181 |
182 | //layout.RefreshPlotDeviceInfo();
183 |
184 | //ConfigName 指定打印机配置名。用于布局或打印配置的 PC3 文件或打印设备的名称。
185 | layout.ConfigName = PlotConfigName;
186 |
187 | layout.StyleSheet = StyleSheet;
188 |
189 | #region
190 |
191 | /*
192 | //PlotType 指定布局或打印配置的类型。
193 | //acDisplay 打印当前显示的所有对象。
194 | //acExtents 打印当前选定空间范围内的所有对象。
195 | //acLimits 打印当前空间界限内的所有对象。
196 | //acView 打印在ViewToPlot属性中命名的视口。
197 | //acWindow 打印在SetWindowToPlot方法中指定的窗口中的所有对象。
198 | //acLayout 打印指定纸张尺寸边界内的所有对象,它的原点是由布局选项卡中从坐标(0,0)计算得到。该选项在从模型空间打印时不可用。
199 |
200 | * */
201 |
202 | #endregion
203 |
204 | layout.PlotType = AcPlotType.acExtents;
205 |
206 | //PlotWithPlotStyles:指定对象是按在打印样式文件中分配的配置打印,还是按图形文件中的配置打印。
207 | layout.PlotWithPlotStyles = true;
208 |
209 | //CanonicalMediaName 按名称指定图纸尺寸.String[字符串]; 可读写,图纸尺寸的名称
210 | layout.CanonicalMediaName = CanonicalMediaName;
211 | layout.PaperUnits = AcPlotPaperUnits.acMillimeters;
212 | layout.PlotOrigin = new double[] {0, 0};
213 | layout.UseStandardScale = true;
214 | layout.StandardScale = AcPlotScale.acScaleToFit;
215 | if (MapSheet == "A3" || MapSheet=="A4")
216 | layout.PlotRotation = Angle == 0 ? AcPlotRotation.ac90degrees : AcPlotRotation.ac0degrees;
217 | else
218 | layout.PlotRotation = Angle == 90 ? AcPlotRotation.ac90degrees : AcPlotRotation.ac0degrees;
219 | layout.RefreshPlotDeviceInfo();
220 | double w, h;
221 | layout.GetPaperSize(out w,out h);
222 | Console.WriteLine(@"图幅:{0},{1}*{2}", CanonicalMediaName,w, h);
223 |
224 | doc.Plot.PlotToDevice(null);
225 | doc.Close(false);
226 |
227 | PrintedNum++;
228 | }
229 | catch (Exception ex)
230 | {
231 | MessageBox.Show(string.Format("调用CAD执行批量打印时发生错误!\n错误描述:{0}", ex.Message), @"批量打印",
232 | MessageBoxButtons.OK, MessageBoxIcon.Error);
233 | throw;
234 | }
235 | }
236 | }
237 |
238 | public void Screen()
239 | {
240 | using (var cad = new AutoCadConnector())
241 | {
242 | try
243 | {
244 | AcadDocument doc = cad.Application.Documents.Open(FileFullName);
245 | Scale = Convert.ToDouble(doc.GetVariable("DIMSCALE"));
246 |
247 | var points = (double[]) doc.Limits;
248 |
249 | var width = (int) Math.Ceiling((points[2] - points[0])/Scale);
250 | var height = (int) Math.Ceiling((points[3] - points[1])/Scale);
251 |
252 | //Console.WriteLine(@"file name:{0},GetPaperSize:{1}*{2}", FileShortName, w,h);
253 | doc.Close(false, "");
254 | Angle = width > height ? 0 : 90;
255 | Width = width;
256 | Height = height;
257 | PrintedNum = 0;
258 | }
259 | catch (Exception ex)
260 | {
261 | MessageBox.Show(string.Format("调用CAD执行图纸筛选时时发生错误!\n错误描述:{0}", ex.Message), @"批量打印",
262 | MessageBoxButtons.OK, MessageBoxIcon.Error);
263 | throw;
264 | }
265 | }
266 | }
267 |
268 | public static void Open(string filepath)
269 | {
270 | var cad = new AutoCadConnector();
271 | cad.Application.Documents.Open(filepath);
272 | cad.Application.Visible = true;
273 | }
274 |
275 | public void Open()
276 | {
277 | if(string.IsNullOrEmpty(FileFullName.Trim()))
278 | {
279 | var cad = new AutoCadConnector();
280 | cad.Application.Documents.Open(FileFullName);
281 | cad.Application.Visible = true;
282 | }
283 | }
284 | }
285 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/CADPaperSizeDict.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace CADPlot.myClass
7 | {
8 | class CADPaperSizeDict
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/CadPaperToPrint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 | using AutoCAD;
7 |
8 | namespace CADPlot.Moudle
9 | {
10 | public class CadPaperForPrinting : CadPapers
11 | {
12 | public CadPaperForPrinting()
13 | {
14 | }
15 |
16 | public CadPaperForPrinting(string rootPath)
17 | {
18 | RootPath = rootPath;
19 | }
20 |
21 | ///
22 | /// 待打印图纸目录
23 | ///
24 | public string RootPath { get; set; }
25 |
26 | public CadPapers A0S
27 | {
28 | get
29 | {
30 | var paperList = new CadPapers();
31 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A0"));
32 | return paperList;
33 | }
34 | }
35 |
36 | public CadPapers A1S
37 | {
38 | get
39 | {
40 | var paperList = new CadPapers();
41 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A1"));
42 | return paperList;
43 | }
44 | }
45 |
46 | public CadPapers A2S
47 | {
48 | get
49 | {
50 | var paperList = new CadPapers();
51 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A2"));
52 | return paperList;
53 | }
54 | }
55 |
56 | public CadPapers A3S
57 | {
58 | get
59 | {
60 | var paperList = new CadPapers();
61 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A3"));
62 | return paperList;
63 | }
64 | }
65 |
66 | public CadPapers A4S
67 | {
68 | get
69 | {
70 | var paperList = new CadPapers();
71 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A4"));
72 | return paperList;
73 | }
74 | }
75 |
76 | public CadPapers A33S
77 | {
78 | get
79 | {
80 | var paperList = new CadPapers();
81 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A33"));
82 | return paperList;
83 | }
84 | }
85 |
86 | public CadPapers A34S
87 | {
88 | get
89 | {
90 | var paperList = new CadPapers();
91 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A34"));
92 | return paperList;
93 | }
94 | }
95 |
96 | public CadPapers A43S
97 | {
98 | get
99 | {
100 | var paperList = new CadPapers();
101 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A43"));
102 | return paperList;
103 | }
104 | }
105 |
106 | public CadPapers A44S
107 | {
108 | get
109 | {
110 | var paperList = new CadPapers();
111 | paperList.AddRange(this.Where(papre => papre.MapSheet == "A44"));
112 | return paperList;
113 | }
114 | }
115 |
116 | public CadPapers OtherSizePapers
117 | {
118 | get
119 | {
120 | var paperList = new CadPapers();
121 | paperList.AddRange(this.Where(papre => papre.MapSheet == "other".ToUpper()));
122 | return paperList;
123 | }
124 | }
125 |
126 | ///
127 | /// 读取所有待打印文件列表
128 | ///
129 | private void SelectDwgFiles(string papterRootPath)
130 | {
131 | try
132 | {
133 | if (string.IsNullOrEmpty(papterRootPath)) return;
134 | var rootFolder = new DirectoryInfo(papterRootPath);
135 | FileInfo[] files = rootFolder.GetFiles("*.dwg");
136 | foreach (CadPaper p in files.Select(fileInfo => new CadPaper {FileFullName = fileInfo.FullName}))
137 | {
138 | Add(p);
139 | }
140 |
141 | foreach (DirectoryInfo folder in rootFolder.GetDirectories())
142 | {
143 | SelectDwgFiles(folder.FullName);
144 | }
145 | }
146 | catch (Exception ex)
147 | {
148 | MessageBox.Show(string.Format("读取文件发生错误,错误描述:{0}", ex.Message));
149 | }
150 | }
151 |
152 | ///
153 | /// 获取待打印图纸列表
154 | ///
155 | public void ReadFilesForPrinting()
156 | {
157 | Clear();
158 | SelectDwgFiles(RootPath);
159 | }
160 | }
161 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/CadPapers(冲突_bluebird-workpc_2013-12-07 15-37-16).cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Windows.Forms;
6 | using AutoCAD;
7 |
8 | namespace CADPlot.Moudle
9 | {
10 |
11 | public delegate void CadPaperProgressEventHandler(CadPaperProgressEventArgs args);
12 |
13 | public enum CadPaperProgressSender
14 | {
15 | 打印,
16 | 筛选
17 | }
18 |
19 | public struct CadPaperProgressEventArgs
20 | {
21 | public CadPaperProgressEventArgs(CadPaperProgressSender senderMethod, CadPaper currentCadPaper, int count,
22 | int currentPoint)
23 | : this()
24 | {
25 | Count = count;
26 | CurrentPoint = currentPoint;
27 | SenderMethod = senderMethod;
28 | CurrentPaper = currentCadPaper;
29 | }
30 |
31 | public int Count { get; set; }
32 | public int CurrentPoint { get; set; }
33 |
34 | public CadPaperProgressSender SenderMethod { get; set; }
35 | public CadPaper CurrentPaper { get; set; }
36 | }
37 |
38 | public class CadPapers : List
39 | {
40 | public event CadPaperProgressEventHandler CadPaperProgress;
41 |
42 | ///
43 | /// 折合A4张数
44 | ///
45 | public virtual int ForA4Count
46 | {
47 | get
48 | {
49 | return this.Where(papre => papre.MapSheet != "other")
50 | .Aggregate(0, (current, papre) => current + papre.ForA4);
51 | }
52 | }
53 |
54 | ///
55 | /// 自然张数
56 | ///
57 | public virtual int NatureCount
58 | {
59 | get { return this.Count(); }
60 | }
61 |
62 | protected virtual void OnCadPaperProgress(CadPaperProgressEventArgs args)
63 | {
64 | CadPaperProgressEventHandler handler = CadPaperProgress;
65 | if (handler != null) handler(args);
66 | }
67 |
68 | public virtual void Plot()
69 | {
70 | using (new AutoCadConnector())
71 | {
72 | int i = 1;
73 | foreach (CadPaper cadpaper in this)
74 | {
75 | try
76 | {
77 | cadpaper.Print();
78 | Thread.Sleep(500);
79 | var args = new CadPaperProgressEventArgs
80 | {
81 | Count = Count,
82 | CurrentPoint = i++,
83 | CurrentPaper = cadpaper,
84 | SenderMethod = CadPaperProgressSender.打印
85 | };
86 | OnCadPaperProgress(args);
87 | Application.DoEvents();
88 | }
89 | catch (Exception)
90 | {
91 | break;
92 | }
93 | }
94 | }
95 | }
96 |
97 | public void Screen()
98 | {
99 | using (new AutoCadConnector())
100 | {
101 | int i = 1;
102 | foreach (CadPaper paper in this)
103 | {
104 | paper.Screen();
105 | Application.DoEvents();
106 |
107 | var args = new CadPaperProgressEventArgs
108 | {
109 | Count = Count,
110 | CurrentPoint = i++,
111 | CurrentPaper = paper,
112 | SenderMethod = CadPaperProgressSender.筛选
113 | };
114 | OnCadPaperProgress(args);
115 | }
116 | }
117 | }
118 | }
119 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Moudle/CadPapers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Windows.Forms;
6 | using AutoCAD;
7 |
8 | namespace CADPlot.Moudle
9 | {
10 |
11 | public delegate void CadPaperProgressEventHandler(CadPaperProgressEventArgs args);
12 |
13 | public enum CadPaperProgressSender
14 | {
15 | 打印,
16 | 筛选,
17 | 打印完成,
18 | 筛选完成,
19 | 运行错误
20 | }
21 |
22 | public class CadPaperProgressEventArgs:EventArgs
23 | {
24 | public int Count { get; set; }
25 | public int CurrentPoint { get; set; }
26 |
27 | public CadPaperProgressSender SenderMethod { get; set; }
28 | public CadPaper CurrentPaper { get; set; }
29 | }
30 |
31 | public class CadPapers : List
32 | {
33 | public event CadPaperProgressEventHandler CadPaperProgress;
34 |
35 | ///
36 | /// 折合A4张数
37 | ///
38 | public virtual int ForA4Count
39 | {
40 | get
41 | {
42 | return this.Where(papre => papre.MapSheet != "other")
43 | .Aggregate(0, (current, papre) => current + papre.ForA4);
44 | }
45 | }
46 |
47 | ///
48 | /// 自然张数
49 | ///
50 | public virtual int NatureCount
51 | {
52 | get { return this.Count(); }
53 | }
54 |
55 | protected virtual void OnCadPaperProgress(CadPaperProgressEventArgs args)
56 | {
57 | CadPaperProgressEventHandler handler = CadPaperProgress;
58 | if (handler != null)
59 | {
60 | handler(args);
61 | }
62 | }
63 |
64 | public virtual void Plot()
65 | {
66 | using (new AutoCadConnector())
67 | {
68 | int i = 1;
69 | foreach (CadPaper cadpaper in this)
70 | {
71 | try
72 | {
73 | if (cadpaper.MapSheet.ToLower()=="other")
74 | continue;
75 | cadpaper.Print();
76 | //Thread.Sleep(500);
77 | var args = new CadPaperProgressEventArgs
78 | {
79 | Count = Count,
80 | CurrentPoint = i++,
81 | CurrentPaper = cadpaper,
82 | SenderMethod = CadPaperProgressSender.打印
83 | };
84 | OnCadPaperProgress(args);
85 | }
86 | catch (COMException ex)
87 | {
88 | MessageBox.Show(string.Format("调用CAD程序进行批量打印时出错!\n请先手工打开Autocad界面再尝试重新筛选!\n错误描述:{0}", ex.Message), @"CAD批量打印",
89 | MessageBoxButtons.OK, MessageBoxIcon.Error);
90 | OnCadPaperProgress(new CadPaperProgressEventArgs { SenderMethod = CadPaperProgressSender.运行错误 });
91 | break;
92 | }
93 | catch (Exception ex)
94 | {
95 | MessageBox.Show(string.Format("CAD批量打印输出时出错!\n错误描述:{0}",ex.Message),@"CAD批量打印",MessageBoxButtons.OK,MessageBoxIcon.Error);
96 | OnCadPaperProgress(new CadPaperProgressEventArgs { SenderMethod = CadPaperProgressSender.运行错误 });
97 | break;
98 | }
99 | }
100 | }
101 | OnCadPaperProgress(new CadPaperProgressEventArgs { SenderMethod = CadPaperProgressSender.打印完成 });
102 | }
103 |
104 | public void Screen()
105 | {
106 | //var startDate=DateTime.Now;
107 | using (AutoCadConnector cad = new AutoCadConnector())
108 | {
109 | int i = 1;
110 | foreach (CadPaper paper in this)
111 | {
112 | try
113 | {
114 | //AcadDocument doc = cad.Application.Documents.Open(paper.FileFullName);
115 | //paper.Scale = Convert.ToDouble(doc.GetVariable("DIMSCALE"));
116 |
117 | //var points = (double[]) doc.Limits;
118 |
119 | //var width = (int) Math.Ceiling((points[2] - points[0])/paper.Scale);
120 | //var height = (int) Math.Ceiling((points[3] - points[1])/paper.Scale);
121 |
122 | //doc.Close(false, "");
123 | //paper.Angle = width > height ? 90 : 0;
124 | //paper.Width = width;
125 | //paper.Height = height;
126 | //paper.PrintedNum = 0;
127 |
128 | paper.Screen();
129 | var args = new CadPaperProgressEventArgs
130 | {
131 | Count = Count,
132 | CurrentPoint = i++,
133 | CurrentPaper = paper,
134 | SenderMethod = CadPaperProgressSender.筛选
135 | };
136 | //Console.WriteLine(@"begin invoke OnCadPaperProgress ,id:{0},{1}",Thread.CurrentThread.ManagedThreadId,i);
137 | OnCadPaperProgress(args);
138 | }
139 | catch (COMException ex)
140 | {
141 | MessageBox.Show(string.Format("调用CAD程序图幅筛选时出错!\n请先手工打开Autocad界面再尝试重新筛选!\n错误描述:{0}", ex.Message), @"CAD批量打印",
142 | MessageBoxButtons.OK, MessageBoxIcon.Error);
143 | OnCadPaperProgress(new CadPaperProgressEventArgs { SenderMethod = CadPaperProgressSender.运行错误 });
144 | break;
145 | }
146 | catch (Exception ex)
147 | {
148 | MessageBox.Show(string.Format("程序在图幅筛选时出错!\n错误描述:{0}", ex.Message), @"CAD批量打印",
149 | MessageBoxButtons.OK, MessageBoxIcon.Error);
150 | OnCadPaperProgress(new CadPaperProgressEventArgs {SenderMethod = CadPaperProgressSender.运行错误});
151 | break;
152 | }
153 | }
154 | }
155 |
156 | OnCadPaperProgress(new CadPaperProgressEventArgs{ SenderMethod = CadPaperProgressSender.筛选完成});
157 | //Console.WriteLine(@"end invoke OnCadPaperProgress");
158 | //var endTime = DateTime.Now;
159 | //var n = endTime.Subtract(startDate).TotalSeconds;
160 | //Console.WriteLine(@"总共耗时:{0}",n);
161 | }
162 | }
163 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/OptionsDialog.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CADPlot
2 | {
3 | partial class OptionsDialog
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsDialog));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.cbPrinterList = new System.Windows.Forms.ComboBox();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.cbSize = new System.Windows.Forms.ComboBox();
36 | this.btOK = new System.Windows.Forms.Button();
37 | this.btCancel = new System.Windows.Forms.Button();
38 | this.label3 = new System.Windows.Forms.Label();
39 | this.cbSettingFor = new System.Windows.Forms.ComboBox();
40 | this.lblPaperSize = new System.Windows.Forms.Label();
41 | this.SuspendLayout();
42 | //
43 | // label1
44 | //
45 | this.label1.AutoSize = true;
46 | this.label1.Location = new System.Drawing.Point(13, 64);
47 | this.label1.Name = "label1";
48 | this.label1.Size = new System.Drawing.Size(83, 12);
49 | this.label1.TabIndex = 0;
50 | this.label1.Text = "打印设备(&P):";
51 | //
52 | // cbPrinterList
53 | //
54 | this.cbPrinterList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
55 | this.cbPrinterList.FormattingEnabled = true;
56 | this.cbPrinterList.Location = new System.Drawing.Point(15, 79);
57 | this.cbPrinterList.Name = "cbPrinterList";
58 | this.cbPrinterList.Size = new System.Drawing.Size(289, 20);
59 | this.cbPrinterList.TabIndex = 1;
60 | this.cbPrinterList.SelectedIndexChanged += new System.EventHandler(this.cbPrinterList_SelectedIndexChanged);
61 | //
62 | // label2
63 | //
64 | this.label2.AutoSize = true;
65 | this.label2.Location = new System.Drawing.Point(13, 107);
66 | this.label2.Name = "label2";
67 | this.label2.Size = new System.Drawing.Size(83, 12);
68 | this.label2.TabIndex = 2;
69 | this.label2.Text = "打印图幅(&S):";
70 | //
71 | // cbSize
72 | //
73 | this.cbSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
74 | this.cbSize.FormattingEnabled = true;
75 | this.cbSize.ItemHeight = 12;
76 | this.cbSize.Location = new System.Drawing.Point(14, 123);
77 | this.cbSize.Name = "cbSize";
78 | this.cbSize.Size = new System.Drawing.Size(288, 20);
79 | this.cbSize.TabIndex = 3;
80 | this.cbSize.SelectedIndexChanged += new System.EventHandler(this.cbSize_SelectedIndexChanged);
81 | //
82 | // btOK
83 | //
84 | this.btOK.Location = new System.Drawing.Point(54, 187);
85 | this.btOK.Name = "btOK";
86 | this.btOK.Size = new System.Drawing.Size(75, 23);
87 | this.btOK.TabIndex = 4;
88 | this.btOK.Text = "应用(&O)";
89 | this.btOK.UseVisualStyleBackColor = true;
90 | this.btOK.Click += new System.EventHandler(this.btOK_Click);
91 | //
92 | // btCancel
93 | //
94 | this.btCancel.Location = new System.Drawing.Point(178, 187);
95 | this.btCancel.Name = "btCancel";
96 | this.btCancel.Size = new System.Drawing.Size(75, 23);
97 | this.btCancel.TabIndex = 5;
98 | this.btCancel.Text = "关闭(&C)";
99 | this.btCancel.UseVisualStyleBackColor = true;
100 | this.btCancel.Click += new System.EventHandler(this.btCancel_Click);
101 | //
102 | // label3
103 | //
104 | this.label3.AutoSize = true;
105 | this.label3.Location = new System.Drawing.Point(13, 21);
106 | this.label3.Name = "label3";
107 | this.label3.Size = new System.Drawing.Size(83, 12);
108 | this.label3.TabIndex = 0;
109 | this.label3.Text = "设置图幅(&P):";
110 | //
111 | // cbSettingFor
112 | //
113 | this.cbSettingFor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
114 | this.cbSettingFor.FormattingEnabled = true;
115 | this.cbSettingFor.Location = new System.Drawing.Point(15, 36);
116 | this.cbSettingFor.Name = "cbSettingFor";
117 | this.cbSettingFor.Size = new System.Drawing.Size(289, 20);
118 | this.cbSettingFor.TabIndex = 1;
119 | this.cbSettingFor.SelectedIndexChanged += new System.EventHandler(this.cbSettingFor_SelectedIndexChanged);
120 | //
121 | // lblPaperSize
122 | //
123 | this.lblPaperSize.AutoSize = true;
124 | this.lblPaperSize.Location = new System.Drawing.Point(13, 155);
125 | this.lblPaperSize.Name = "lblPaperSize";
126 | this.lblPaperSize.Size = new System.Drawing.Size(65, 12);
127 | this.lblPaperSize.TabIndex = 6;
128 | this.lblPaperSize.Text = "打印尺寸:";
129 | //
130 | // OptionsDialog
131 | //
132 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
133 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
134 | this.ClientSize = new System.Drawing.Size(310, 213);
135 | this.Controls.Add(this.lblPaperSize);
136 | this.Controls.Add(this.btCancel);
137 | this.Controls.Add(this.btOK);
138 | this.Controls.Add(this.cbSize);
139 | this.Controls.Add(this.label2);
140 | this.Controls.Add(this.cbSettingFor);
141 | this.Controls.Add(this.cbPrinterList);
142 | this.Controls.Add(this.label3);
143 | this.Controls.Add(this.label1);
144 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
145 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
146 | this.MaximizeBox = false;
147 | this.Name = "OptionsDialog";
148 | this.Text = "选项";
149 | this.ResumeLayout(false);
150 | this.PerformLayout();
151 |
152 | }
153 |
154 | #endregion
155 |
156 | private System.Windows.Forms.Label label1;
157 | private System.Windows.Forms.ComboBox cbPrinterList;
158 | private System.Windows.Forms.Label label2;
159 | private System.Windows.Forms.ComboBox cbSize;
160 | private System.Windows.Forms.Button btOK;
161 | private System.Windows.Forms.Button btCancel;
162 | private System.Windows.Forms.Label label3;
163 | private System.Windows.Forms.ComboBox cbSettingFor;
164 | private System.Windows.Forms.Label lblPaperSize;
165 |
166 |
167 | }
168 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/OptionsDialog.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Drawing.Printing;
4 | using System.Windows.Forms;
5 | using AutoCAD;
6 | using CADPlot.Moudle;
7 |
8 | namespace CADPlot
9 | {
10 | public partial class OptionsDialog : Form
11 | {
12 | private bool IsInit;
13 | private readonly Dictionary mediaNameDictionary = new Dictionary();
14 |
15 | public OptionsDialog()
16 | {
17 | Initialize();
18 | }
19 |
20 | private void Initialize()
21 | {
22 | InitializeComponent();
23 | //PrinterSettings.StringCollection p = PrinterSettings.InstalledPrinters;
24 |
25 | //foreach (object i in p)
26 | // cbPrinterList.Items.Add(i.ToString());
27 |
28 | //currentOptionItems = AppConfig.GetOptionItems();
29 | IsInit = true;
30 | foreach (var item in AppConfig.CadPapreConfigDictionary)
31 | cbSettingFor.Items.Add(item.Value.Name);
32 | foreach (var i in GetPrinterList())
33 | cbPrinterList.Items.Add(i);
34 | IsInit = false;
35 |
36 | }
37 |
38 | private static IEnumerable GetPrinterList()
39 | {
40 | try
41 | {
42 | using (var cad = new AutoCadConnector())
43 | {
44 | AcadDocument doc;
45 | if (cad.Application.Documents.Count > 0)
46 | doc = cad.Application.Documents.Item(0) ?? cad.Application.Documents.Add();
47 | else
48 | doc = cad.Application.Application.Documents.Add();
49 |
50 | AcadLayout layout = doc.ModelSpace.Layout;
51 |
52 | layout.RefreshPlotDeviceInfo();
53 | var plots = (string[]) layout.GetPlotDeviceNames();
54 |
55 | if (cad.Application.Documents.Count > 0)
56 | doc.Close(false, "");
57 | return plots;
58 | }
59 | }
60 | catch (Exception ex)
61 | {
62 | MessageBox.Show(string.Format("程序运行出错,错误描述:{0}", ex.Message), @"批量打印", MessageBoxButtons.OK,
63 | MessageBoxIcon.Error);
64 | return null;
65 | }
66 | }
67 |
68 | private void cbPrinterList_SelectedIndexChanged(object sender, EventArgs e)
69 | {
70 | if (IsInit) return;
71 | if (cbPrinterList.SelectedIndex < 0)
72 | return;
73 |
74 | using (var cad = new AutoCadConnector())
75 | {
76 | try
77 | {
78 | AcadDocument doc;
79 | if (cad.Application.Documents.Count > 0)
80 | doc = cad.Application.Documents.Item(0) ?? cad.Application.Documents.Add();
81 | else
82 | doc = cad.Application.Application.Documents.Add();
83 |
84 | AcadLayout layout = doc.ModelSpace.Layout;
85 |
86 | if (cbPrinterList.Text != @"无" || string.IsNullOrEmpty(cbPrinterList.Text))
87 | {
88 |
89 | layout.RefreshPlotDeviceInfo();
90 | layout.ConfigName = cbPrinterList.Text;
91 | var p = (string[]) layout.GetCanonicalMediaNames();
92 | cbSize.Items.Clear();
93 | mediaNameDictionary.Clear();
94 | foreach (var s in p)
95 | {
96 | var LocaleMediaName = layout.GetLocaleMediaName(s);
97 | cbSize.Items.Add(LocaleMediaName);
98 | mediaNameDictionary[LocaleMediaName] = s;
99 |
100 | }
101 | //cbSize.DataSource = p;
102 | }
103 | else
104 | {
105 | cbSize.Items.Clear();
106 | mediaNameDictionary.Clear();
107 | }
108 | doc.Close(false, "");
109 | }
110 | catch(Exception ex)
111 | {
112 | MessageBox.Show(string.Format("调用CAD程序出错!\n错误描述:{0}",ex.Message), @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Error);
113 | }
114 |
115 | }
116 | }
117 |
118 | private void btCancel_Click(object sender, EventArgs e)
119 | {
120 | Close();
121 | }
122 |
123 | private void btOK_Click(object sender, EventArgs e)
124 | {
125 | //var item=new AppConfig.OptionItem
126 | //{
127 | // Name=cbSettingFor.Text,Printer=cbPrinterList.Text,CanonicalMediaName=cbSize.Text
128 | //};
129 | //item.SaveToConfig();;
130 | string paperName = cbSettingFor.Text;
131 | if (AppConfig.CadPapreConfigDictionary.ContainsKey(paperName))
132 | {
133 | AppConfig.CadPapreConfigDictionary[paperName].Printer = cbPrinterList.Text;
134 | if (mediaNameDictionary.ContainsKey(cbSize.Text))
135 | {
136 | AppConfig.CadPapreConfigDictionary[paperName].CanonicalMediaName = mediaNameDictionary[cbSize.Text];
137 | AppConfig.CadPapreConfigDictionary[paperName].LocaleMediaName = cbSize.Text;
138 | }
139 | AppConfig.Save();
140 | }
141 | }
142 |
143 | private void cbSettingFor_SelectedIndexChanged(object sender, EventArgs e)
144 | {
145 | string selectedFormatName = cbSettingFor.Text;
146 | if (AppConfig.CadPapreConfigDictionary.ContainsKey(selectedFormatName))
147 | {
148 | CadDrawingConfigElement settingfor = AppConfig.CadPapreConfigDictionary[selectedFormatName];
149 |
150 | cbPrinterList.SelectedIndex = -1;
151 | for (int i = 0; i < cbPrinterList.Items.Count; i++)
152 | {
153 | if (cbPrinterList.Items[i].ToString() == settingfor.Printer)
154 | {
155 | cbPrinterList.SelectedIndex = i;
156 | break;
157 | }
158 | }
159 |
160 | if (cbSize.Items.Count > 0)
161 | cbSize.SelectedIndex = -1;
162 | for (int i = 0; i < cbSize.Items.Count; i++)
163 | {
164 | if (cbSize.Items[i].ToString() == settingfor.CanonicalMediaName)
165 | {
166 | cbSize.SelectedIndex = i;
167 | break;
168 | }
169 | }
170 | }
171 | }
172 |
173 | private void cbSize_SelectedIndexChanged(object sender, EventArgs e)
174 | {
175 | using (var cad = new AutoCadConnector())
176 | {
177 | try
178 | {
179 | AcadDocument doc;
180 | if (cad.Application.Documents.Count > 0)
181 | doc = cad.Application.Documents.Item(0) ?? cad.Application.Documents.Add();
182 | else
183 | doc = cad.Application.Application.Documents.Add();
184 |
185 | AcadLayout layout = doc.ModelSpace.Layout;
186 |
187 | layout.ConfigName = cbPrinterList.Text;
188 | layout.CanonicalMediaName = mediaNameDictionary[cbSize.Text];
189 |
190 | double w, h;
191 | layout.GetPaperSize(out w, out h);
192 | layout.PlotRotation = w > h ? AcPlotRotation.ac0degrees : AcPlotRotation.ac90degrees;
193 | layout.RefreshPlotDeviceInfo();
194 | lblPaperSize.Text = string.Format("打印尺寸:{0}*{1}", Math.Ceiling(w), Math.Ceiling(h));
195 | }
196 | catch (Exception ex)
197 | {
198 | MessageBox.Show(string.Format("调用CAD程序出错!\n错误描述:{0}", ex.Message), @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Error);
199 |
200 | }
201 | }
202 | }
203 | }
204 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace CADPlot
5 | {
6 | internal static class Program
7 | {
8 | ///
9 | /// 应用程序的主入口点。
10 | ///
11 | [STAThread]
12 | private static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 | Application.Run(new frmShow());
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // 有关程序集的常规信息通过以下
5 | // 特性集控制。更改这些特性值可修改
6 | // 与程序集关联的信息。
7 |
8 | [assembly: AssemblyTitle("CADPlot")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("CHINA")]
12 | [assembly: AssemblyProduct("CADPlot")]
13 | [assembly: AssemblyCopyright("Copyright © CHINA 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 |
21 | [assembly: ComVisible(false)]
22 |
23 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
24 |
25 | [assembly: Guid("5ad7ec26-ec0e-4e88-9302-cd5d9589dd73")]
26 |
27 | // 程序集的版本信息由下面四个值组成:
28 | //
29 | // 主版本
30 | // 次版本
31 | // 内部版本号
32 | // 修订号
33 | //
34 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
35 | // 方法是按如下所示使用“*”:
36 | // [assembly: AssemblyVersion("1.0.*")]
37 |
38 | [assembly: AssemblyVersion("1.0.0.0")]
39 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本:4.0.30319.1
5 | //
6 | // 对此文件的更改可能会导致不正确的行为,并且如果
7 | // 重新生成代码,这些更改将会丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace CADPlot.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// 一个强类型的资源类,用于查找本地化的字符串等。
17 | ///
18 | // 此类是由 StronglyTypedResourceBuilder
19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21 | // (以 /str 作为命令选项),或重新生成 VS 项目。
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// 返回此类使用的缓存的 ResourceManager 实例。
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CADPlot.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// 使用此强类型资源类,为所有资源查找
51 | /// 重写当前线程的 CurrentUICulture 属性。
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | internal static System.Drawing.Bitmap add {
64 | get {
65 | object obj = ResourceManager.GetObject("add", resourceCulture);
66 | return ((System.Drawing.Bitmap)(obj));
67 | }
68 | }
69 |
70 | internal static System.Drawing.Bitmap admintools {
71 | get {
72 | object obj = ResourceManager.GetObject("admintools", resourceCulture);
73 | return ((System.Drawing.Bitmap)(obj));
74 | }
75 | }
76 |
77 | internal static System.Drawing.Bitmap books {
78 | get {
79 | object obj = ResourceManager.GetObject("books", resourceCulture);
80 | return ((System.Drawing.Bitmap)(obj));
81 | }
82 | }
83 |
84 | internal static System.Drawing.Bitmap file {
85 | get {
86 | object obj = ResourceManager.GetObject("file", resourceCulture);
87 | return ((System.Drawing.Bitmap)(obj));
88 | }
89 | }
90 |
91 | internal static System.Drawing.Bitmap filter {
92 | get {
93 | object obj = ResourceManager.GetObject("filter", resourceCulture);
94 | return ((System.Drawing.Bitmap)(obj));
95 | }
96 | }
97 |
98 | internal static System.Drawing.Bitmap money {
99 | get {
100 | object obj = ResourceManager.GetObject("money", resourceCulture);
101 | return ((System.Drawing.Bitmap)(obj));
102 | }
103 | }
104 |
105 | internal static System.Drawing.Bitmap open {
106 | get {
107 | object obj = ResourceManager.GetObject("open", resourceCulture);
108 | return ((System.Drawing.Bitmap)(obj));
109 | }
110 | }
111 |
112 | internal static System.Drawing.Bitmap opened {
113 | get {
114 | object obj = ResourceManager.GetObject("opened", resourceCulture);
115 | return ((System.Drawing.Bitmap)(obj));
116 | }
117 | }
118 |
119 | internal static System.Drawing.Bitmap pin_blue {
120 | get {
121 | object obj = ResourceManager.GetObject("pin_blue", resourceCulture);
122 | return ((System.Drawing.Bitmap)(obj));
123 | }
124 | }
125 |
126 | internal static System.Drawing.Bitmap pin_green {
127 | get {
128 | object obj = ResourceManager.GetObject("pin_green", resourceCulture);
129 | return ((System.Drawing.Bitmap)(obj));
130 | }
131 | }
132 |
133 | internal static System.Drawing.Bitmap Print {
134 | get {
135 | object obj = ResourceManager.GetObject("Print", resourceCulture);
136 | return ((System.Drawing.Bitmap)(obj));
137 | }
138 | }
139 |
140 | internal static System.Drawing.Bitmap printer {
141 | get {
142 | object obj = ResourceManager.GetObject("printer", resourceCulture);
143 | return ((System.Drawing.Bitmap)(obj));
144 | }
145 | }
146 |
147 | internal static System.Drawing.Bitmap set {
148 | get {
149 | object obj = ResourceManager.GetObject("set", resourceCulture);
150 | return ((System.Drawing.Bitmap)(obj));
151 | }
152 | }
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\pin_blue.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
125 | ..\Resources\set.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
126 |
127 |
128 | ..\Resources\pin_green.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
131 | ..\Resources\filter.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
132 |
133 |
134 | ..\Resources\admintools.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
135 |
136 |
137 | ..\Resources\printer.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
138 |
139 |
140 | ..\Resources\books.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
141 |
142 |
143 | ..\Resources\open.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
144 |
145 |
146 | ..\Resources\file.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
147 |
148 |
149 | ..\Resources\add.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
150 |
151 |
152 | ..\Resources\Print.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
153 |
154 |
155 | ..\Resources\opened.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
156 |
157 |
158 | ..\Resources\money.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
159 |
160 |
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/Print.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/Print.png
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/add.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/add.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/addtoprint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/addtoprint.png
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/admintools.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/admintools.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/books.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/books.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/file.png
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/filter.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/filter.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/money.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/money.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/open.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/open.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/open.png
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/opened.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/opened.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/pin_blue.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/pin_blue.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/pin_green.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/pin_green.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/printer.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/printer.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/Resources/set.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/Resources/set.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/CADPlot/CADPlot/favicon.ico
--------------------------------------------------------------------------------
/CADPlot/CADPlot/frmShow.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CADPlot
2 | {
3 | partial class frmShow
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.Windows.Forms.GroupBox groupBox1;
33 | System.Windows.Forms.Label label3;
34 | System.Windows.Forms.Label label2;
35 | System.Windows.Forms.Label label1;
36 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmShow));
37 | this.txtPrintSize = new System.Windows.Forms.TextBox();
38 | this.txtPrinter = new System.Windows.Forms.TextBox();
39 | this.checkBox1 = new System.Windows.Forms.CheckBox();
40 | this.btPrint = new System.Windows.Forms.Button();
41 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
42 | this.statusStrip1 = new System.Windows.Forms.StatusStrip();
43 | this.lblCurrentFolder = new System.Windows.Forms.ToolStripStatusLabel();
44 | this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
45 | this.fbdOpen = new System.Windows.Forms.FolderBrowserDialog();
46 | this.lvDataView = new System.Windows.Forms.ListView();
47 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
48 | this.menuPrintSelected = new System.Windows.Forms.ToolStripMenuItem();
49 | this.menuDelSelected = new System.Windows.Forms.ToolStripMenuItem();
50 | this.toolStrip1 = new System.Windows.Forms.ToolStrip();
51 | this.tbAdd = new System.Windows.Forms.ToolStripButton();
52 | this.tbFilter = new System.Windows.Forms.ToolStripButton();
53 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
54 | this.tbMapSheet = new System.Windows.Forms.ToolStripDropDownButton();
55 | this.btA4 = new System.Windows.Forms.ToolStripMenuItem();
56 | this.btA3 = new System.Windows.Forms.ToolStripMenuItem();
57 | this.btA2 = new System.Windows.Forms.ToolStripMenuItem();
58 | this.btA1 = new System.Windows.Forms.ToolStripMenuItem();
59 | this.btA0 = new System.Windows.Forms.ToolStripMenuItem();
60 | this.btA43 = new System.Windows.Forms.ToolStripMenuItem();
61 | this.btA44 = new System.Windows.Forms.ToolStripMenuItem();
62 | this.btA33 = new System.Windows.Forms.ToolStripMenuItem();
63 | this.btA34 = new System.Windows.Forms.ToolStripMenuItem();
64 | this.btOther = new System.Windows.Forms.ToolStripMenuItem();
65 | this.btAll = new System.Windows.Forms.ToolStripMenuItem();
66 | this.tbCount = new System.Windows.Forms.ToolStripButton();
67 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
68 | this.tbSetting = new System.Windows.Forms.ToolStripButton();
69 | this.tbPrint = new System.Windows.Forms.ToolStripButton();
70 | this.lblTotal = new System.Windows.Forms.ToolStripStatusLabel();
71 | this.lblForA4 = new System.Windows.Forms.ToolStripStatusLabel();
72 | groupBox1 = new System.Windows.Forms.GroupBox();
73 | label3 = new System.Windows.Forms.Label();
74 | label2 = new System.Windows.Forms.Label();
75 | label1 = new System.Windows.Forms.Label();
76 | groupBox1.SuspendLayout();
77 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
78 | this.contextMenuStrip1.SuspendLayout();
79 | this.toolStrip1.SuspendLayout();
80 | this.SuspendLayout();
81 | //
82 | // groupBox1
83 | //
84 | groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
85 | | System.Windows.Forms.AnchorStyles.Left)
86 | | System.Windows.Forms.AnchorStyles.Right)));
87 | groupBox1.Controls.Add(this.txtPrintSize);
88 | groupBox1.Controls.Add(this.txtPrinter);
89 | groupBox1.Controls.Add(this.checkBox1);
90 | groupBox1.Controls.Add(this.btPrint);
91 | groupBox1.Controls.Add(this.numericUpDown1);
92 | groupBox1.Controls.Add(label3);
93 | groupBox1.Controls.Add(label2);
94 | groupBox1.Controls.Add(label1);
95 | groupBox1.Location = new System.Drawing.Point(0, 42);
96 | groupBox1.Name = "groupBox1";
97 | groupBox1.Size = new System.Drawing.Size(703, 82);
98 | groupBox1.TabIndex = 8;
99 | groupBox1.TabStop = false;
100 | groupBox1.Text = "打印设置";
101 | //
102 | // txtPrintSize
103 | //
104 | this.txtPrintSize.Location = new System.Drawing.Point(69, 54);
105 | this.txtPrintSize.Name = "txtPrintSize";
106 | this.txtPrintSize.ReadOnly = true;
107 | this.txtPrintSize.Size = new System.Drawing.Size(205, 21);
108 | this.txtPrintSize.TabIndex = 10;
109 | //
110 | // txtPrinter
111 | //
112 | this.txtPrinter.Location = new System.Drawing.Point(69, 22);
113 | this.txtPrinter.Name = "txtPrinter";
114 | this.txtPrinter.ReadOnly = true;
115 | this.txtPrinter.Size = new System.Drawing.Size(206, 21);
116 | this.txtPrinter.TabIndex = 9;
117 | //
118 | // checkBox1
119 | //
120 | this.checkBox1.AutoSize = true;
121 | this.checkBox1.Location = new System.Drawing.Point(299, 59);
122 | this.checkBox1.Name = "checkBox1";
123 | this.checkBox1.Size = new System.Drawing.Size(96, 16);
124 | this.checkBox1.TabIndex = 8;
125 | this.checkBox1.Text = "允许重复打印";
126 | this.checkBox1.UseVisualStyleBackColor = true;
127 | //
128 | // btPrint
129 | //
130 | this.btPrint.Image = global::CADPlot.Properties.Resources.printer;
131 | this.btPrint.Location = new System.Drawing.Point(420, 20);
132 | this.btPrint.Name = "btPrint";
133 | this.btPrint.Size = new System.Drawing.Size(110, 55);
134 | this.btPrint.TabIndex = 6;
135 | this.btPrint.Text = "打印(&P)";
136 | this.btPrint.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
137 | this.btPrint.UseVisualStyleBackColor = true;
138 | this.btPrint.Click += new System.EventHandler(this.OnPrint_Click);
139 | //
140 | // numericUpDown1
141 | //
142 | this.numericUpDown1.Location = new System.Drawing.Point(353, 23);
143 | this.numericUpDown1.Name = "numericUpDown1";
144 | this.numericUpDown1.Size = new System.Drawing.Size(42, 21);
145 | this.numericUpDown1.TabIndex = 5;
146 | this.numericUpDown1.Value = new decimal(new int[] {
147 | 1,
148 | 0,
149 | 0,
150 | 0});
151 | //
152 | // label3
153 | //
154 | label3.AutoSize = true;
155 | label3.Location = new System.Drawing.Point(295, 27);
156 | label3.Name = "label3";
157 | label3.Size = new System.Drawing.Size(65, 12);
158 | label3.TabIndex = 4;
159 | label3.Text = "打印份数:";
160 | //
161 | // label2
162 | //
163 | label2.AutoSize = true;
164 | label2.Location = new System.Drawing.Point(10, 59);
165 | label2.Name = "label2";
166 | label2.Size = new System.Drawing.Size(65, 12);
167 | label2.TabIndex = 2;
168 | label2.Text = "图纸尺寸:";
169 | //
170 | // label1
171 | //
172 | label1.AutoSize = true;
173 | label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
174 | label1.Location = new System.Drawing.Point(10, 27);
175 | label1.Name = "label1";
176 | label1.Size = new System.Drawing.Size(65, 12);
177 | label1.TabIndex = 0;
178 | label1.Text = "打印设备:";
179 | //
180 | // statusStrip1
181 | //
182 | this.statusStrip1.Location = new System.Drawing.Point(0, 557);
183 | this.statusStrip1.Name = "statusStrip1";
184 | this.statusStrip1.Size = new System.Drawing.Size(703, 22);
185 | this.statusStrip1.TabIndex = 1;
186 | this.statusStrip1.Text = "statusStrip1";
187 | //
188 | // lblCurrentFolder
189 | //
190 | this.lblCurrentFolder.AutoSize = false;
191 | this.lblCurrentFolder.AutoToolTip = true;
192 | this.lblCurrentFolder.BorderStyle = System.Windows.Forms.Border3DStyle.Etched;
193 | this.lblCurrentFolder.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
194 | this.lblCurrentFolder.Name = "lblCurrentFolder";
195 | this.lblCurrentFolder.Size = new System.Drawing.Size(200, 21);
196 | this.lblCurrentFolder.Text = "文件夹:";
197 | this.lblCurrentFolder.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
198 | //
199 | // toolStripProgressBar1
200 | //
201 | this.toolStripProgressBar1.AutoToolTip = true;
202 | this.toolStripProgressBar1.Name = "toolStripProgressBar1";
203 | this.toolStripProgressBar1.Size = new System.Drawing.Size(200, 20);
204 | this.toolStripProgressBar1.Visible = false;
205 | //
206 | // lvDataView
207 | //
208 | this.lvDataView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
209 | | System.Windows.Forms.AnchorStyles.Left)
210 | | System.Windows.Forms.AnchorStyles.Right)));
211 | this.lvDataView.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
212 | this.lvDataView.FullRowSelect = true;
213 | this.lvDataView.GridLines = true;
214 | this.lvDataView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
215 | this.lvDataView.Location = new System.Drawing.Point(0, 130);
216 | this.lvDataView.Name = "lvDataView";
217 | this.lvDataView.Size = new System.Drawing.Size(703, 423);
218 | this.lvDataView.TabIndex = 11;
219 | this.lvDataView.TileSize = new System.Drawing.Size(150, 100);
220 | this.lvDataView.UseCompatibleStateImageBehavior = false;
221 | this.lvDataView.View = System.Windows.Forms.View.Details;
222 | this.lvDataView.DoubleClick += new System.EventHandler(this.lvDataView_DoubleClick);
223 | this.lvDataView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lvDataView_MouseDown);
224 | //
225 | // contextMenuStrip1
226 | //
227 | this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
228 | this.menuPrintSelected,
229 | this.menuDelSelected});
230 | this.contextMenuStrip1.Name = "contextMenuStrip1";
231 | this.contextMenuStrip1.Size = new System.Drawing.Size(95, 48);
232 | //
233 | // menuPrintSelected
234 | //
235 | this.menuPrintSelected.Name = "menuPrintSelected";
236 | this.menuPrintSelected.Size = new System.Drawing.Size(94, 22);
237 | this.menuPrintSelected.Text = "打印";
238 | //
239 | // menuDelSelected
240 | //
241 | this.menuDelSelected.Name = "menuDelSelected";
242 | this.menuDelSelected.Size = new System.Drawing.Size(94, 22);
243 | this.menuDelSelected.Text = "删除";
244 | //
245 | // toolStrip1
246 | //
247 | this.toolStrip1.ImageScalingSize = new System.Drawing.Size(32, 32);
248 | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
249 | this.tbAdd,
250 | this.tbFilter,
251 | this.toolStripSeparator2,
252 | this.tbMapSheet,
253 | this.tbCount,
254 | this.toolStripSeparator1,
255 | this.tbSetting,
256 | this.tbPrint,
257 | this.lblTotal,
258 | this.lblForA4});
259 | this.toolStrip1.Location = new System.Drawing.Point(0, 0);
260 | this.toolStrip1.Name = "toolStrip1";
261 | this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
262 | this.toolStrip1.Size = new System.Drawing.Size(703, 39);
263 | this.toolStrip1.Stretch = true;
264 | this.toolStrip1.TabIndex = 12;
265 | this.toolStrip1.Text = "toolStrip1";
266 | //
267 | // tbAdd
268 | //
269 | this.tbAdd.Image = global::CADPlot.Properties.Resources.add;
270 | this.tbAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
271 | this.tbAdd.Name = "tbAdd";
272 | this.tbAdd.Size = new System.Drawing.Size(65, 36);
273 | this.tbAdd.Text = "打开";
274 | this.tbAdd.Click += new System.EventHandler(this.tbAdd_Click);
275 | //
276 | // tbFilter
277 | //
278 | this.tbFilter.Image = global::CADPlot.Properties.Resources.filter;
279 | this.tbFilter.ImageTransparentColor = System.Drawing.Color.Magenta;
280 | this.tbFilter.Name = "tbFilter";
281 | this.tbFilter.Size = new System.Drawing.Size(65, 36);
282 | this.tbFilter.Text = "筛选";
283 | this.tbFilter.Click += new System.EventHandler(this.tbFilter_Click);
284 | //
285 | // toolStripSeparator2
286 | //
287 | this.toolStripSeparator2.Name = "toolStripSeparator2";
288 | this.toolStripSeparator2.Size = new System.Drawing.Size(6, 39);
289 | //
290 | // tbMapSheet
291 | //
292 | this.tbMapSheet.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
293 | this.btA4,
294 | this.btA3,
295 | this.btA2,
296 | this.btA1,
297 | this.btA0,
298 | this.btA43,
299 | this.btA44,
300 | this.btA33,
301 | this.btA34,
302 | this.btOther,
303 | this.btAll});
304 | this.tbMapSheet.Image = global::CADPlot.Properties.Resources.books;
305 | this.tbMapSheet.ImageTransparentColor = System.Drawing.Color.Magenta;
306 | this.tbMapSheet.Name = "tbMapSheet";
307 | this.tbMapSheet.Size = new System.Drawing.Size(74, 36);
308 | this.tbMapSheet.Text = "图幅";
309 | //
310 | // btA4
311 | //
312 | this.btA4.Name = "btA4";
313 | this.btA4.Size = new System.Drawing.Size(152, 22);
314 | this.btA4.Text = "A4";
315 | this.btA4.Click += new System.EventHandler(this.OnMapSheetClick);
316 | //
317 | // btA3
318 | //
319 | this.btA3.Name = "btA3";
320 | this.btA3.Size = new System.Drawing.Size(152, 22);
321 | this.btA3.Text = "A3";
322 | this.btA3.Click += new System.EventHandler(this.OnMapSheetClick);
323 | //
324 | // btA2
325 | //
326 | this.btA2.Name = "btA2";
327 | this.btA2.Size = new System.Drawing.Size(152, 22);
328 | this.btA2.Text = "A2";
329 | this.btA2.Click += new System.EventHandler(this.OnMapSheetClick);
330 | //
331 | // btA1
332 | //
333 | this.btA1.Name = "btA1";
334 | this.btA1.Size = new System.Drawing.Size(152, 22);
335 | this.btA1.Text = "A1";
336 | this.btA1.Click += new System.EventHandler(this.OnMapSheetClick);
337 | //
338 | // btA0
339 | //
340 | this.btA0.Name = "btA0";
341 | this.btA0.Size = new System.Drawing.Size(152, 22);
342 | this.btA0.Text = "A0";
343 | this.btA0.Click += new System.EventHandler(this.OnMapSheetClick);
344 | //
345 | // btA43
346 | //
347 | this.btA43.Name = "btA43";
348 | this.btA43.Size = new System.Drawing.Size(152, 22);
349 | this.btA43.Text = "A4*3";
350 | this.btA43.Click += new System.EventHandler(this.OnMapSheetClick);
351 | //
352 | // btA44
353 | //
354 | this.btA44.Name = "btA44";
355 | this.btA44.Size = new System.Drawing.Size(152, 22);
356 | this.btA44.Text = "A4*4";
357 | this.btA44.Click += new System.EventHandler(this.OnMapSheetClick);
358 | //
359 | // btA33
360 | //
361 | this.btA33.Name = "btA33";
362 | this.btA33.Size = new System.Drawing.Size(152, 22);
363 | this.btA33.Text = "A3*3";
364 | this.btA33.Click += new System.EventHandler(this.OnMapSheetClick);
365 | //
366 | // btA34
367 | //
368 | this.btA34.Name = "btA34";
369 | this.btA34.Size = new System.Drawing.Size(152, 22);
370 | this.btA34.Text = "A3*4";
371 | this.btA34.Click += new System.EventHandler(this.OnMapSheetClick);
372 | //
373 | // btOther
374 | //
375 | this.btOther.Name = "btOther";
376 | this.btOther.Size = new System.Drawing.Size(152, 22);
377 | this.btOther.Text = "其它";
378 | this.btOther.Click += new System.EventHandler(this.OnMapSheetClick);
379 | //
380 | // btAll
381 | //
382 | this.btAll.Name = "btAll";
383 | this.btAll.Size = new System.Drawing.Size(152, 22);
384 | this.btAll.Text = "全部";
385 | this.btAll.Click += new System.EventHandler(this.OnMapSheetClick);
386 | //
387 | // tbCount
388 | //
389 | this.tbCount.Image = global::CADPlot.Properties.Resources.money;
390 | this.tbCount.ImageTransparentColor = System.Drawing.Color.Magenta;
391 | this.tbCount.Name = "tbCount";
392 | this.tbCount.Size = new System.Drawing.Size(65, 36);
393 | this.tbCount.Text = "统计";
394 | this.tbCount.Click += new System.EventHandler(this.tbCount_Click);
395 | //
396 | // toolStripSeparator1
397 | //
398 | this.toolStripSeparator1.Name = "toolStripSeparator1";
399 | this.toolStripSeparator1.Size = new System.Drawing.Size(6, 39);
400 | //
401 | // tbSetting
402 | //
403 | this.tbSetting.Image = global::CADPlot.Properties.Resources.admintools;
404 | this.tbSetting.ImageTransparentColor = System.Drawing.Color.Magenta;
405 | this.tbSetting.Name = "tbSetting";
406 | this.tbSetting.Size = new System.Drawing.Size(65, 36);
407 | this.tbSetting.Text = "设置";
408 | this.tbSetting.Click += new System.EventHandler(this.tbSetting_Click);
409 | //
410 | // tbPrint
411 | //
412 | this.tbPrint.Image = global::CADPlot.Properties.Resources.Print;
413 | this.tbPrint.ImageTransparentColor = System.Drawing.Color.Magenta;
414 | this.tbPrint.Name = "tbPrint";
415 | this.tbPrint.Size = new System.Drawing.Size(65, 36);
416 | this.tbPrint.Text = "打印";
417 | this.tbPrint.Click += new System.EventHandler(this.OnPrint_Click);
418 | //
419 | // lblTotal
420 | //
421 | this.lblTotal.AutoSize = false;
422 | this.lblTotal.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)));
423 | this.lblTotal.BorderStyle = System.Windows.Forms.Border3DStyle.Etched;
424 | this.lblTotal.Image = global::CADPlot.Properties.Resources.pin_blue;
425 | this.lblTotal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
426 | this.lblTotal.Name = "lblTotal";
427 | this.lblTotal.Size = new System.Drawing.Size(100, 21);
428 | this.lblTotal.Text = "自然张数:0";
429 | this.lblTotal.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
430 | //
431 | // lblForA4
432 | //
433 | this.lblForA4.AutoSize = false;
434 | this.lblForA4.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
435 | this.lblForA4.BorderStyle = System.Windows.Forms.Border3DStyle.Etched;
436 | this.lblForA4.Image = global::CADPlot.Properties.Resources.pin_green;
437 | this.lblForA4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
438 | this.lblForA4.Name = "lblForA4";
439 | this.lblForA4.Size = new System.Drawing.Size(100, 21);
440 | this.lblForA4.Text = "折合A4:0";
441 | this.lblForA4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
442 | //
443 | // frmShow
444 | //
445 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
446 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
447 | this.ClientSize = new System.Drawing.Size(703, 579);
448 | this.Controls.Add(this.toolStrip1);
449 | this.Controls.Add(this.statusStrip1);
450 | this.Controls.Add(this.lvDataView);
451 | this.Controls.Add(groupBox1);
452 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
453 | this.Name = "frmShow";
454 | this.Text = "CAD批量打印";
455 | groupBox1.ResumeLayout(false);
456 | groupBox1.PerformLayout();
457 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
458 | this.contextMenuStrip1.ResumeLayout(false);
459 | this.toolStrip1.ResumeLayout(false);
460 | this.toolStrip1.PerformLayout();
461 | this.ResumeLayout(false);
462 | this.PerformLayout();
463 |
464 | }
465 |
466 | #endregion
467 |
468 | private System.Windows.Forms.StatusStrip statusStrip1;
469 | private System.Windows.Forms.ToolStripStatusLabel lblCurrentFolder;
470 | private System.Windows.Forms.ToolStripStatusLabel lblTotal;
471 | private System.Windows.Forms.ToolStripStatusLabel lblForA4;
472 | private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
473 | private System.Windows.Forms.FolderBrowserDialog fbdOpen;
474 | private System.Windows.Forms.TextBox txtPrintSize;
475 | private System.Windows.Forms.TextBox txtPrinter;
476 | private System.Windows.Forms.CheckBox checkBox1;
477 | private System.Windows.Forms.Button btPrint;
478 | private System.Windows.Forms.NumericUpDown numericUpDown1;
479 | private System.Windows.Forms.ListView lvDataView;
480 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
481 | private System.Windows.Forms.ToolStripMenuItem menuPrintSelected;
482 | private System.Windows.Forms.ToolStripMenuItem menuDelSelected;
483 | private System.Windows.Forms.ToolStrip toolStrip1;
484 | private System.Windows.Forms.ToolStripButton tbAdd;
485 | private System.Windows.Forms.ToolStripButton tbFilter;
486 | private System.Windows.Forms.ToolStripButton tbPrint;
487 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
488 | private System.Windows.Forms.ToolStripButton tbSetting;
489 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
490 | private System.Windows.Forms.ToolStripDropDownButton tbMapSheet;
491 | private System.Windows.Forms.ToolStripMenuItem btA4;
492 | private System.Windows.Forms.ToolStripMenuItem btA3;
493 | private System.Windows.Forms.ToolStripMenuItem btA2;
494 | private System.Windows.Forms.ToolStripMenuItem btA1;
495 | private System.Windows.Forms.ToolStripMenuItem btA43;
496 | private System.Windows.Forms.ToolStripMenuItem btA44;
497 | private System.Windows.Forms.ToolStripMenuItem btA33;
498 | private System.Windows.Forms.ToolStripMenuItem btA34;
499 | private System.Windows.Forms.ToolStripMenuItem btOther;
500 | private System.Windows.Forms.ToolStripMenuItem btAll;
501 | private System.Windows.Forms.ToolStripMenuItem btA0;
502 | private System.Windows.Forms.ToolStripButton tbCount;
503 | }
504 | }
--------------------------------------------------------------------------------
/CADPlot/CADPlot/frmShow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Threading;
6 | using System.Windows.Forms;
7 | using CADPlot.Moudle;
8 |
9 | namespace CADPlot
10 | {
11 | public delegate void UpdateUIAttrib();
12 |
13 | public partial class frmShow : Form
14 | {
15 | private enum DataViewColumn
16 | {
17 | 是否已打印 = 0,
18 | 文件名 = 1,
19 | 图幅 = 2,
20 | 已打印 = 3,
21 | 角度 = 4,
22 | 比例 = 5,
23 | 宽度 = 6,
24 | 高度 = 7,
25 | 文件路径 = 8,
26 | 打印机 = 9,
27 | 打印尺寸 = 10,
28 | 打印样式 = 11
29 | }
30 |
31 | private readonly CadPaperForPrinting _cadPapersForPrinting = new CadPaperForPrinting();
32 | private bool _hasFillter;
33 | private bool _isBusy;
34 | private string _currentMapSheet = "";
35 | private CadPapers _currentPapers;
36 |
37 | public frmShow()
38 | {
39 | InitializeComponent();
40 | SetDataViewFormat();
41 | Initialize();
42 |
43 | _cadPapersForPrinting.CadPaperProgress += OnCadPaperProgress;
44 | menuDelSelected.Click += menuDelSelected_Click;
45 | menuPrintSelected.Click += menuPrintSelected_Click;
46 | }
47 |
48 | private void Initialize()
49 | {
50 | btA0.Text = CadPaper.PaperNameDictionary["A0"];
51 | btA1.Text = CadPaper.PaperNameDictionary["A1"];
52 | btA2.Text = CadPaper.PaperNameDictionary["A2"];
53 | btA3.Text = CadPaper.PaperNameDictionary["A3"];
54 | btA4.Text = CadPaper.PaperNameDictionary["A4"];
55 | btA43.Text = CadPaper.PaperNameDictionary["A43"];
56 | btA44.Text = CadPaper.PaperNameDictionary["A44"];
57 | btA33.Text = CadPaper.PaperNameDictionary["A33"];
58 | btA34.Text = CadPaper.PaperNameDictionary["A34"];
59 | btOther.Text = CadPaper.PaperNameDictionary["OTHER"];
60 |
61 | SetControlEnable(false);
62 | tbAdd.Enabled = true;
63 |
64 | lblCurrentFolder.Text = @"文件夹:";
65 | lblTotal.Text = @"自然张数:0";
66 | lblForA4.Text = @"折合A4:0";
67 |
68 | statusStrip1.Items.Add(lblCurrentFolder);
69 | statusStrip1.Items.Add(lblTotal);
70 | statusStrip1.Items.Add(lblForA4);
71 | statusStrip1.Items.Add(toolStripProgressBar1);
72 |
73 | _hasFillter = false;
74 | }
75 |
76 | private void lvDataView_DoubleClick(object sender, EventArgs e)
77 | {
78 | if (lvDataView.SelectedItems.Count > 0)
79 | {
80 | CadPaper.Open(lvDataView.SelectedItems[0].SubItems[(int) DataViewColumn.文件路径].Text);
81 | }
82 | }
83 |
84 | private void lvDataView_MouseDown(object sender, MouseEventArgs e)
85 | {
86 | if (_isBusy) return;
87 | if (e.Button == MouseButtons.Right)
88 | lvDataView.ContextMenuStrip = contextMenuStrip1;
89 | }
90 |
91 | private void menuPrintSelected_Click(object sender, EventArgs e)
92 | {
93 | if (_isBusy || !_hasFillter) return;
94 | CadPapers selectedPapers = GetCurrentSelectedCadPapers();
95 | if (selectedPapers != null)
96 | {
97 | _isBusy = true;
98 | selectedPapers.CadPaperProgress += OnCadPaperProgress;
99 | selectedPapers.Plot();
100 | }
101 | }
102 |
103 | private void menuDelSelected_Click(object sender, EventArgs e)
104 | {
105 | if (_isBusy) return;
106 | CadPapers selectedPapers = GetCurrentSelectedCadPapers();
107 | if (selectedPapers != null)
108 | {
109 | foreach (CadPaper selectedPaper in selectedPapers)
110 | {
111 | _cadPapersForPrinting.Remove(selectedPaper);
112 | }
113 | AddDataToListView(_cadPapersForPrinting);
114 | }
115 | }
116 |
117 | private void tbAdd_Click(object sender, EventArgs e)
118 | {
119 | if (_isBusy)
120 | {
121 | MessageBox.Show(@"打印机正在工作,请稍后再重试!", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
122 | return;
123 | }
124 |
125 | try
126 | {
127 | if (fbdOpen.ShowDialog() != DialogResult.OK) return;
128 | if (fbdOpen.SelectedPath == null) return;
129 | _cadPapersForPrinting.RootPath = fbdOpen.SelectedPath;
130 | _cadPapersForPrinting.ReadFilesForPrinting();
131 |
132 | AddDataToListView(_cadPapersForPrinting);
133 |
134 | Initialize();
135 |
136 | lblCurrentFolder.Text = string.Format("文件夹:{0}", fbdOpen.SelectedPath);
137 | lblTotal.Text = string.Format("自然张数:{0}", _cadPapersForPrinting.NatureCount);
138 | tbFilter.Enabled = _cadPapersForPrinting.NatureCount>0;
139 | }
140 | catch (Exception exception)
141 | {
142 | MessageBox.Show(string.Format("程序运行发生错误\n错误描述:{0}", exception.Message));
143 | }
144 | }
145 |
146 | private void tbFilter_Click(object sender, EventArgs e)
147 | {
148 | if (_isBusy)
149 | {
150 | MessageBox.Show(@"打印机正在工作,请稍后再重试!", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
151 | return;
152 | }
153 | if (_cadPapersForPrinting.Count == 0)
154 | {
155 | MessageBox.Show(@"需要先打开文件夹,然后再筛选!", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
156 | return;
157 | }
158 | SetControlEnable(false);
159 |
160 | Thread screenThread = new Thread(_cadPapersForPrinting.Screen);
161 | screenThread.Start();
162 | }
163 |
164 | private void OnMapSheetClick(object sender, EventArgs e)
165 | {
166 | if (sender == null || _cadPapersForPrinting == null) return;
167 | if (_isBusy)
168 | {
169 | MessageBox.Show(@"打印机正在工作,请稍后再重试!", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
170 | return;
171 | }
172 | btPrint.Enabled = true;
173 | tbPrint.Enabled = true;
174 | switch (((ToolStripDropDownItem) sender).Name)
175 | {
176 | case "btAll":
177 | _currentPapers = _cadPapersForPrinting;
178 | btPrint.Enabled = false;
179 | tbPrint.Enabled = false;
180 | _currentMapSheet = "All";
181 | break;
182 | case "btA4":
183 | _currentPapers = _cadPapersForPrinting.A4S;
184 | _currentMapSheet = "A4";
185 | break;
186 | case "btA3":
187 | _currentPapers = _cadPapersForPrinting.A3S;
188 | _currentMapSheet = "A3";
189 | break;
190 | case "btA2":
191 | _currentPapers = _cadPapersForPrinting.A2S;
192 | _currentMapSheet = "A2";
193 | break;
194 | case "btA1":
195 | _currentPapers = _cadPapersForPrinting.A1S;
196 | _currentMapSheet = "A1";
197 | break;
198 | case "btA0":
199 | _currentPapers = _cadPapersForPrinting.A0S;
200 | _currentMapSheet = "A0";
201 | break;
202 | case "btA43":
203 | _currentPapers = _cadPapersForPrinting.A43S;
204 | _currentMapSheet = "A43";
205 | break;
206 | case "btA44":
207 | _currentPapers = _cadPapersForPrinting.A44S;
208 | _currentMapSheet = "A44";
209 | break;
210 | case "btA33":
211 | _currentPapers = _cadPapersForPrinting.A33S;
212 | _currentMapSheet = "A33";
213 | break;
214 | case "btA34":
215 | _currentPapers = _cadPapersForPrinting.A34S;
216 | _currentMapSheet = "A34";
217 | break;
218 | case "btOther":
219 | _currentPapers = _cadPapersForPrinting.OtherSizePapers;
220 | _currentMapSheet = "OTHER";
221 | btPrint.Enabled = false;
222 | tbPrint.Enabled = false;
223 | break;
224 |
225 | }
226 |
227 | AddDataToListView(_currentPapers);
228 |
229 | if (AppConfig.CadPapreConfigDictionary.ContainsKey(_currentMapSheet))
230 | {
231 | txtPrinter.Text = AppConfig.CadPapreConfigDictionary[_currentMapSheet].Printer;
232 | txtPrintSize.Text = AppConfig.CadPapreConfigDictionary[_currentMapSheet].LocaleMediaName;
233 | }
234 | }
235 |
236 | private void tbSetting_Click(object sender, EventArgs e)
237 | {
238 | if (_isBusy)
239 | {
240 | MessageBox.Show(@"打印机正在工作,请稍后再重试!", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
241 | return;
242 | }
243 | var f = new OptionsDialog();
244 | f.ShowDialog();
245 |
246 | if (AppConfig.CadPapreConfigDictionary.ContainsKey(_currentMapSheet))
247 | {
248 | txtPrinter.Text = AppConfig.CadPapreConfigDictionary[_currentMapSheet].Printer;
249 | txtPrintSize.Text = AppConfig.CadPapreConfigDictionary[_currentMapSheet].CanonicalMediaName;
250 | }
251 | }
252 |
253 | private void OnPrint_Click(object sender, EventArgs e)
254 | {
255 | if (_isBusy || _currentPapers == null) return;
256 | //if (currentPapers == null) return;
257 | _isBusy = true;
258 | _currentPapers.CadPaperProgress += OnCadPaperProgress;
259 | _currentPapers.Plot();
260 | }
261 |
262 | ///
263 | /// 设置ListView控件显示格式
264 | ///
265 | private void SetDataViewFormat()
266 | {
267 | #region
268 |
269 | //dataGridViewCheckBoxColumn1 = new DataGridViewCheckBoxColumn();
270 | //dataGridViewTextBoxColumn2 = new DataGridViewTextBoxColumn();
271 | //dataGridViewTextBoxColumn3 = new DataGridViewTextBoxColumn();
272 | //dataGridViewTextBoxColumn4 = new DataGridViewTextBoxColumn();
273 | //dataGridViewTextBoxColumn5 = new DataGridViewTextBoxColumn();
274 | //dataGridViewTextBoxColumn6 = new DataGridViewTextBoxColumn();
275 | //dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
276 | //dataGridViewTextBoxColumn8 = new DataGridViewTextBoxColumn();
277 | //dataGridViewTextBoxColumn9 = new DataGridViewTextBoxColumn();
278 | //dataGridViewTextBoxColumn10 = new DataGridViewTextBoxColumn();
279 | //dataGridViewTextBoxColumn11 = new DataGridViewTextBoxColumn();
280 | //dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
281 | //dataGridViewTextBoxColumn12 = new DataGridViewTextBoxColumn();
282 | //
283 | // dgPaperList
284 | //
285 | //dgPaperList.AllowUserToAddRows = false;
286 | //dgPaperList.AllowUserToDeleteRows = false;
287 | //dgPaperList.Anchor =
288 | // ((AnchorStyles.Top | AnchorStyles.Bottom)
289 | // | AnchorStyles.Left)
290 | // | AnchorStyles.Right;
291 | //dgPaperList.AutoGenerateColumns = false;
292 | //dgPaperList.BorderStyle = BorderStyle.Fixed3D;
293 | //var dataGridViewCellStyle1 = new DataGridViewCellStyle
294 | //{
295 | // Alignment = DataGridViewContentAlignment.MiddleCenter,
296 | // BackColor = SystemColors.Control,
297 | // Font =
298 | // new Font("宋体", 9F, FontStyle.Regular,
299 | // GraphicsUnit.Point, 134),
300 | // ForeColor = SystemColors.WindowText,
301 | // SelectionBackColor = SystemColors.Highlight,
302 | // SelectionForeColor = SystemColors.HighlightText,
303 | // WrapMode = DataGridViewTriState.False
304 | //};
305 | //dgPaperList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
306 | //dgPaperList.ColumnHeadersHeightSizeMode =
307 | // DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
308 | //dgPaperList.Columns.AddRange(new DataGridViewColumn[]
309 | //{
310 | // dataGridViewCheckBoxColumn1,
311 | // dataGridViewTextBoxColumn2,
312 | // dataGridViewTextBoxColumn3,
313 | // dataGridViewTextBoxColumn4,
314 | // dataGridViewTextBoxColumn5,
315 | // dataGridViewTextBoxColumn6,
316 | // dataGridViewTextBoxColumn7,
317 | // dataGridViewTextBoxColumn8,
318 | // dataGridViewTextBoxColumn9,
319 | // dataGridViewTextBoxColumn10,
320 | // dataGridViewTextBoxColumn11,
321 | // dataGridViewTextBoxColumn1,
322 | // dataGridViewTextBoxColumn12
323 | //});
324 | //this.dgPaperList.DataSource = this.cadPapersBindingSource;
325 | //dgPaperList.Location = new Point(164, 142);
326 | //dgPaperList.Name = "dgPaperList";
327 | //dgPaperList.ReadOnly = true;
328 | //dgPaperList.RowHeadersWidth = 20;
329 | //dgPaperList.RowHeadersWidthSizeMode =
330 | // DataGridViewRowHeadersWidthSizeMode.DisableResizing;
331 | //dgPaperList.RowTemplate.Height = 23;
332 | //dgPaperList.RowTemplate.ReadOnly = true;
333 | //dgPaperList.RowTemplate.Resizable = DataGridViewTriState.False;
334 | //dgPaperList.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
335 | //dgPaperList.Size = new Size(538, 450);
336 | //dgPaperList.TabIndex = 9;
337 | //
338 | // dataGridViewCheckBoxColumn1
339 | //
340 | //dataGridViewCheckBoxColumn1.AutoSizeMode =
341 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
342 | //dataGridViewCheckBoxColumn1.DataPropertyName = "IsPrinted";
343 | //dataGridViewCheckBoxColumn1.HeaderText = @"已打印";
344 | //dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1";
345 | //dataGridViewCheckBoxColumn1.ReadOnly = true;
346 | //dataGridViewCheckBoxColumn1.Width = 47;
347 |
348 | // dataGridViewTextBoxColumn2
349 |
350 | //dataGridViewTextBoxColumn2.AutoSizeMode =
351 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
352 | //dataGridViewTextBoxColumn2.DataPropertyName = "FormatName";
353 | //dataGridViewTextBoxColumn2.HeaderText = @"图幅";
354 | //dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
355 | //dataGridViewTextBoxColumn2.ReadOnly = true;
356 | //dataGridViewTextBoxColumn2.Width = 54;
357 |
358 | // dataGridViewTextBoxColumn3
359 |
360 | //dataGridViewTextBoxColumn3.AutoSizeMode =
361 | // DataGridViewAutoSizeColumnMode.DisplayedCells;
362 | //dataGridViewTextBoxColumn3.DataPropertyName = "FileShortName";
363 | //dataGridViewTextBoxColumn3.HeaderText = @"文件名";
364 | //dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
365 | //dataGridViewTextBoxColumn3.ReadOnly = true;
366 | //dataGridViewTextBoxColumn3.Width = 66;
367 |
368 | // dataGridViewTextBoxColumn4
369 |
370 | //dataGridViewTextBoxColumn4.AutoSizeMode =
371 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
372 | //dataGridViewTextBoxColumn4.DataPropertyName = "Scale";
373 | //dataGridViewTextBoxColumn4.HeaderText = @"比例";
374 | //dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
375 | //dataGridViewTextBoxColumn4.ReadOnly = true;
376 | //dataGridViewTextBoxColumn4.Width = 54;
377 |
378 | // dataGridViewTextBoxColumn5
379 |
380 | //dataGridViewTextBoxColumn5.AutoSizeMode =
381 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
382 | //dataGridViewTextBoxColumn5.DataPropertyName = "Angle";
383 | //dataGridViewTextBoxColumn5.HeaderText = @"角度";
384 | //dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
385 | //dataGridViewTextBoxColumn5.ReadOnly = true;
386 | //dataGridViewTextBoxColumn5.Width = 54;
387 |
388 | // dataGridViewTextBoxColumn6
389 |
390 | //dataGridViewTextBoxColumn6.AutoSizeMode =
391 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
392 | //dataGridViewTextBoxColumn6.DataPropertyName = "PrintedNum";
393 | //dataGridViewTextBoxColumn6.HeaderText = @"打印数量";
394 | //dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
395 | //dataGridViewTextBoxColumn6.ReadOnly = true;
396 | //dataGridViewTextBoxColumn6.Width = 78;
397 |
398 | // dataGridViewTextBoxColumn7
399 |
400 | //dataGridViewTextBoxColumn7.AutoSizeMode =
401 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
402 | //dataGridViewTextBoxColumn7.DataPropertyName = "Width";
403 | //dataGridViewTextBoxColumn7.HeaderText = @"宽度";
404 | //dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
405 | //dataGridViewTextBoxColumn7.ReadOnly = true;
406 | //dataGridViewTextBoxColumn7.Width = 54;
407 |
408 | // dataGridViewTextBoxColumn8
409 |
410 | //dataGridViewTextBoxColumn8.AutoSizeMode =
411 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
412 | //dataGridViewTextBoxColumn8.DataPropertyName = "Height";
413 | //dataGridViewTextBoxColumn8.HeaderText = @"高度";
414 | //dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
415 | //dataGridViewTextBoxColumn8.ReadOnly = true;
416 | //dataGridViewTextBoxColumn8.Width = 54;
417 |
418 | // dataGridViewTextBoxColumn9
419 |
420 | //dataGridViewTextBoxColumn9.AutoSizeMode =
421 | // DataGridViewAutoSizeColumnMode.ColumnHeader;
422 | //dataGridViewTextBoxColumn9.DataPropertyName = "ForA4";
423 | //dataGridViewTextBoxColumn9.HeaderText = @"折合A4";
424 | //dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
425 | //dataGridViewTextBoxColumn9.ReadOnly = true;
426 | //dataGridViewTextBoxColumn9.Width = 66;
427 |
428 | // dataGridViewTextBoxColumn10
429 |
430 | //dataGridViewTextBoxColumn10.AutoSizeMode =
431 | // DataGridViewAutoSizeColumnMode.DisplayedCells;
432 | //dataGridViewTextBoxColumn10.DataPropertyName = "PlotConfigName";
433 | //dataGridViewTextBoxColumn10.HeaderText = @"打印机";
434 | //dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
435 | //dataGridViewTextBoxColumn10.ReadOnly = true;
436 | //dataGridViewTextBoxColumn10.Width = 66;
437 |
438 | // dataGridViewTextBoxColumn11
439 |
440 | //dataGridViewTextBoxColumn11.AutoSizeMode =
441 | // DataGridViewAutoSizeColumnMode.DisplayedCells;
442 | //dataGridViewTextBoxColumn11.DataPropertyName = "CanonicalMediaName";
443 | //dataGridViewTextBoxColumn11.HeaderText = @"图纸尺寸";
444 | //dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
445 | //dataGridViewTextBoxColumn11.ReadOnly = true;
446 | //dataGridViewTextBoxColumn11.Width = 78;
447 |
448 | // dataGridViewTextBoxColumn1
449 |
450 | //dataGridViewTextBoxColumn1.DataPropertyName = "FileFullName";
451 | //dataGridViewTextBoxColumn1.HeaderText = @"文件路径";
452 | //dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
453 | //dataGridViewTextBoxColumn1.ReadOnly = true;
454 |
455 | // dataGridViewTextBoxColumn12
456 |
457 | //dataGridViewTextBoxColumn12.AutoSizeMode =
458 | // DataGridViewAutoSizeColumnMode.DisplayedCells;
459 | //dataGridViewTextBoxColumn12.DataPropertyName = "StyleSheet";
460 | //dataGridViewTextBoxColumn12.HeaderText = @"打印样式";
461 | //dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12";
462 | //dataGridViewTextBoxColumn12.ReadOnly = true;
463 | //dataGridViewTextBoxColumn12.Width = 78;
464 |
465 | #endregion
466 |
467 | lvDataView.Columns.AddRange(new[]
468 | {
469 | new ColumnHeader
470 | {
471 | Name = "isprinted",
472 | Text = @"序号",
473 | Width = 40,
474 | TextAlign = HorizontalAlignment.Center
475 | },
476 | new ColumnHeader
477 | {
478 | Name = "name",
479 | Text = @"文件名",
480 | Width = 120
481 | },
482 | new ColumnHeader
483 | {
484 | Name = "tufu",
485 | Text = @"图幅",
486 | Width = 60,
487 | TextAlign = HorizontalAlignment.Center
488 | },
489 | new ColumnHeader
490 | {
491 | Name = "dysl",
492 | Text = @"已打印",
493 | Width = 60,
494 | TextAlign = HorizontalAlignment.Center
495 | },
496 | new ColumnHeader
497 | {
498 | Name = "jiaodu",
499 | Text = @"角度",
500 | Width = 60,
501 | TextAlign = HorizontalAlignment.Center
502 | },
503 | new ColumnHeader
504 | {
505 | Name = "bili",
506 | Text = @"比例",
507 | Width = 60,
508 | TextAlign = HorizontalAlignment.Center
509 | },
510 | new ColumnHeader
511 | {
512 | Name = "kuandu",
513 | Text = @"宽度",
514 | Width = 60,
515 | TextAlign = HorizontalAlignment.Center
516 | },
517 | new ColumnHeader
518 | {
519 | Name = "gaodu",
520 | Text = @"高度",
521 | Width = 60,
522 | TextAlign = HorizontalAlignment.Center
523 | },
524 | new ColumnHeader
525 | {
526 | Name = "wenjianlujing",
527 | Text = @"文件路径",
528 | Width = 180
529 | },
530 | new ColumnHeader
531 | {
532 | Name = "dayinji",
533 | Text = @"打印机",
534 | Width = 100
535 | },
536 | new ColumnHeader
537 | {
538 | Name = "dayinchicun",
539 | Text = @"打印尺寸",
540 | Width = 60,
541 | TextAlign = HorizontalAlignment.Center
542 | },
543 | new ColumnHeader
544 | {
545 | Name = "dayinyangshi",
546 | Text = @"打印样式",
547 | Width = 100,
548 | TextAlign = HorizontalAlignment.Center
549 | }
550 | });
551 | }
552 |
553 | private void CompleteScreen()
554 | {
555 | #region 设置图幅菜单属性
556 |
557 | //if (_cadPapersForPrinting.A4S.Count > 0)
558 | //{
559 | // btA4.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A4"],
560 | // _cadPapersForPrinting.A4S.Count,
561 | // _cadPapersForPrinting.A4S.ForA4Count);
562 | // btA4.Enabled = true;
563 | //}
564 | //if (_cadPapersForPrinting.A3S.Count > 0)
565 | //{
566 | // btA3.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A3"],
567 | // _cadPapersForPrinting.A3S.Count,
568 | // _cadPapersForPrinting.A3S.ForA4Count);
569 | // btA3.Enabled = true;
570 | //}
571 | //if (_cadPapersForPrinting.A2S.Count > 0)
572 | //{
573 | // btA2.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A2"],
574 | // _cadPapersForPrinting.A2S.Count,
575 | // _cadPapersForPrinting.A2S.ForA4Count);
576 | // btA2.Enabled = true;
577 | //}
578 | //if (_cadPapersForPrinting.A1S.Count > 0)
579 | //{
580 | // btA1.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A1"],
581 | // _cadPapersForPrinting.A1S.Count,
582 | // _cadPapersForPrinting.A1S.ForA4Count);
583 | // btA1.Enabled = true;
584 | //}
585 | //if (_cadPapersForPrinting.A0S.Count > 0)
586 | //{
587 | // btA0.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A0"],
588 | // _cadPapersForPrinting.A0S.Count,
589 | // _cadPapersForPrinting.A0S.ForA4Count);
590 | // btA0.Enabled = true;
591 | //}
592 | //if (_cadPapersForPrinting.A43S.Count > 0)
593 | //{
594 | // btA43.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A43"],
595 | // _cadPapersForPrinting.A43S.Count,
596 | // _cadPapersForPrinting.A43S.ForA4Count);
597 | // btA43.Enabled = true;
598 | //}
599 | //if (_cadPapersForPrinting.A44S.Count > 0)
600 | //{
601 | // btA44.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A44"],
602 | // _cadPapersForPrinting.A44S.Count,
603 | // _cadPapersForPrinting.A44S.ForA4Count);
604 | // btA44.Enabled = true;
605 | //}
606 | //if (_cadPapersForPrinting.A33S.Count > 0)
607 | //{
608 | // btA33.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A33"],
609 | // _cadPapersForPrinting.A33S.Count,
610 | // _cadPapersForPrinting.A0S.ForA4Count);
611 | // btA33.Enabled = true;
612 | //}
613 | //if (_cadPapersForPrinting.A34S.Count > 0)
614 | //{
615 | // btA34.Text = string.Format("{0}({1}|{2})", CadPaper.PaperNameDictionary["A34"],
616 | // _cadPapersForPrinting.A34S.Count,
617 | // _cadPapersForPrinting.A0S.ForA4Count);
618 | // btA34.Enabled = true;
619 | //}
620 | //if (_cadPapersForPrinting.OtherSizePapers.Count > 0)
621 | //{
622 | // btOther.Text = string.Format("{0}({1})", CadPaper.PaperNameDictionary["OTHER"],
623 | // _cadPapersForPrinting.OtherSizePapers.Count);
624 | // btOther.Enabled = true;
625 | //}
626 |
627 | #endregion
628 |
629 | btA0.Enabled = _cadPapersForPrinting.A0S.Count>0;
630 | btA1.Enabled = _cadPapersForPrinting.A1S.Count>0;
631 | btA2.Enabled = _cadPapersForPrinting.A2S.Count>0;
632 | btA3.Enabled = _cadPapersForPrinting.A3S.Count>0;
633 | btA4.Enabled = _cadPapersForPrinting.A4S.Count>0;
634 | btA43.Enabled = _cadPapersForPrinting.A43S.Count>0;
635 | btA44.Enabled = _cadPapersForPrinting.A44S.Count>0;
636 | btA33.Enabled = _cadPapersForPrinting.A33S.Count>0;
637 | btA34.Enabled = _cadPapersForPrinting.A33S.Count>0;
638 | btOther.Enabled = _cadPapersForPrinting.OtherSizePapers.Count>0;
639 |
640 | lblForA4.Text = string.Format("折合A4:{0}", _cadPapersForPrinting.ForA4Count);
641 |
642 | MessageBox.Show(@"所有图纸已经筛选完成", @"批量打印", MessageBoxButtons.OK, MessageBoxIcon.Information);
643 | tbAdd.Enabled = true;
644 | tbFilter.Enabled = true;
645 | tbMapSheet.Enabled = true;
646 | btPrint.Enabled = true;
647 | tbPrint.Enabled = true;
648 | _isBusy = false;
649 | _hasFillter = true;
650 | }
651 |
652 | //是否已打印,1文件名,2图幅,3已打印,4角度,5比例,6宽度,7高度,8文件路径,9打印机,10打印尺寸,11打印样式
653 | private void AddDataToListView(IEnumerable cadPapers)
654 | {
655 | lvDataView.Items.Clear();
656 | int i = 1;
657 | foreach (CadPaper paper in cadPapers)
658 | {
659 | ListViewItem item = lvDataView.Items.Add(string.Format("{0}{1}", paper.IsPrinted ? "*" : "", i));
660 | item.SubItems.AddRange(new[]
661 | {
662 | paper.FileShortName, paper.MapSheet, paper.PrintedNum.ToString(), paper.Angle.ToString(),
663 | paper.Scale.ToString(), paper.Width.ToString(), paper.Height.ToString(), paper.FileFullName,
664 | paper.PlotConfigName, paper.CanonicalMediaName, paper.StyleSheet
665 | });
666 | i++;
667 | }
668 | }
669 |
670 | private void OnCadPaperProgress(CadPaperProgressEventArgs args)
671 | {
672 | Invoke(new CadPaperProgressEventHandler(UpdateUI), args);
673 | }
674 |
675 | private void UpdateUI(object invokeArgs)
676 | {
677 | CadPaperProgressEventArgs args = (CadPaperProgressEventArgs) invokeArgs;
678 | CadPaper paper = args.CurrentPaper;
679 | switch (args.SenderMethod)
680 | {
681 | case CadPaperProgressSender.筛选:
682 | {
683 | ListViewItem item = lvDataView.Items[args.CurrentPoint - 1];
684 | if (item.SubItems[(int) DataViewColumn.文件名].Text == paper.FileShortName)
685 | {
686 | item.SubItems[(int) DataViewColumn.图幅].Text = paper.MapSheet;
687 | item.SubItems[(int) DataViewColumn.已打印].Text =
688 | paper.PrintedNum.ToString(CultureInfo.InvariantCulture);
689 | item.SubItems[(int) DataViewColumn.角度].Text = paper.Angle.ToString(CultureInfo.InvariantCulture);
690 | item.SubItems[(int) DataViewColumn.比例].Text = paper.Scale.ToString(CultureInfo.InvariantCulture);
691 | item.SubItems[(int) DataViewColumn.宽度].Text = paper.Width.ToString(CultureInfo.InvariantCulture);
692 | item.SubItems[(int) DataViewColumn.高度].Text = paper.Height.ToString(CultureInfo.InvariantCulture);
693 | item.SubItems[(int) DataViewColumn.打印机].Text = paper.PlotConfigName;
694 | item.SubItems[(int) DataViewColumn.打印尺寸].Text = paper.CanonicalMediaName;
695 | item.SubItems[(int) DataViewColumn.打印样式].Text = paper.StyleSheet;
696 | }
697 | break;
698 | }
699 | case CadPaperProgressSender.打印:
700 | {
701 | ListViewItem item = lvDataView.Items[args.CurrentPoint - 1];
702 | if (item.SubItems[(int) DataViewColumn.文件名].Text == paper.FileShortName)
703 | {
704 | item.SubItems[(int) DataViewColumn.是否已打印].Text = string.Format("{0}{1}", "*",
705 | item.SubItems[0].Text);
706 | item.SubItems[(int) DataViewColumn.已打印].Text =
707 | paper.PrintedNum.ToString(CultureInfo.InvariantCulture);
708 | }
709 | break;
710 | }
711 | case CadPaperProgressSender.筛选完成:
712 | {
713 | CompleteScreen();
714 | break;
715 | }
716 | case CadPaperProgressSender.打印完成:
717 | {
718 | _isBusy=false;
719 | break;
720 | }
721 | case CadPaperProgressSender.运行错误:
722 | {
723 | _isBusy = false;
724 | break;
725 | }
726 | }
727 |
728 | if (args.CurrentPoint < args.Count)
729 | {
730 | toolStripProgressBar1.Visible = true;
731 | toolStripProgressBar1.Maximum = args.Count;
732 | toolStripProgressBar1.Value = args.CurrentPoint;
733 | }
734 | else
735 | toolStripProgressBar1.Visible = false;
736 | }
737 |
738 | private CadPapers GetCurrentSelectedCadPapers()
739 | {
740 | if (lvDataView.SelectedItems.Count == 0)
741 | return null;
742 | var selectedPapers = new CadPapers();
743 | selectedPapers.AddRange(from ListViewItem selectedItem in lvDataView.SelectedItems
744 | from item in _cadPapersForPrinting
745 | where item.FileFullName == selectedItem.SubItems[(int) DataViewColumn.文件路径].Text
746 | select item);
747 | return selectedPapers;
748 | }
749 |
750 | private void SetControlEnable(bool value)
751 | {
752 | btA0.Enabled = value;
753 | btA1.Enabled = value;
754 | btA2.Enabled = value;
755 | btA3.Enabled = value;
756 | btA4.Enabled = value;
757 | btA43.Enabled = value;
758 | btA44.Enabled = value;
759 | btA33.Enabled = value;
760 | btA34.Enabled = value;
761 | btOther.Enabled = value;
762 |
763 | btPrint.Enabled = value;
764 | tbPrint.Enabled = value;
765 |
766 | tbAdd.Enabled = value;
767 | tbFilter.Enabled = value;
768 | }
769 |
770 | private void tbCount_Click(object sender, EventArgs e)
771 | {
772 | CountForm f = new CountForm(_cadPapersForPrinting);
773 | f.ShowDialog();
774 | }
775 | }
776 | }
777 |
--------------------------------------------------------------------------------
/CADPlot/TestProject1/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/CADPlot/TestProject1/AppConfigTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Configuration;
3 | using CADPlot;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 | using System;
6 |
7 | namespace TestProject1
8 | {
9 |
10 |
11 | ///
12 | ///这是 AppConfigTest 的测试类,旨在
13 | ///包含所有 AppConfigTest 单元测试
14 | ///
15 | [TestClass()]
16 | public class AppConfigTest
17 | {
18 |
19 |
20 | private TestContext testContextInstance;
21 |
22 | ///
23 | ///获取或设置测试上下文,上下文提供
24 | ///有关当前测试运行及其功能的信息。
25 | ///
26 | public TestContext TestContext
27 | {
28 | get
29 | {
30 | return testContextInstance;
31 | }
32 | set
33 | {
34 | testContextInstance = value;
35 | }
36 | }
37 |
38 | #region 附加测试特性
39 | //
40 | //编写测试时,还可使用以下特性:
41 | //
42 | //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
43 | //[ClassInitialize()]
44 | //public static void MyClassInitialize(TestContext testContext)
45 | //{
46 | //}
47 | //
48 | //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
49 | //[ClassCleanup()]
50 | //public static void MyClassCleanup()
51 | //{
52 | //}
53 | //
54 | //使用 TestInitialize 在运行每个测试前先运行代码
55 | //[TestInitialize()]
56 | //public void MyTestInitialize()
57 | //{
58 | //}
59 | //
60 | //使用 TestCleanup 在运行完每个测试后运行代码
61 | //[TestCleanup()]
62 | //public void MyTestCleanup()
63 | //{
64 | //}
65 | //
66 | #endregion
67 |
68 |
69 | ///
70 | ///Save 的测试
71 | ///
72 | [TestMethod()]
73 | public void SaveTest()
74 | {
75 | var test = AppConfig.CadPapreConfigDictionary;
76 | Console.WriteLine(string.Format("配置文件路径:{0}",AppConfig.FilePath));
77 | foreach (var item in test.Values)
78 | {
79 | Console.WriteLine(@"名称:{0},打印机:{1},图幅:{2},折合A4:{3}", item.Name, item.Printer, item.CanonicalMediaName, item.ForA4);
80 |
81 | }
82 | test["A4"].Printer = "sdfasfdasfd";
83 | test["A3"].PaperSize = "234234*42342";
84 | test["A3"].Printer = "asdfwesdfwecxvart232cawwr2";
85 | AppConfig.Save();
86 | Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
87 | ConfigurationManager.RefreshSection("CadDrawingConfig");
88 | var cadDrawingConfig = config.GetSection("CadDrawingConfig") as CadDrawingConfigSection;
89 | var optionDic = new Dictionary();
90 | if (cadDrawingConfig != null)
91 | foreach (CadDrawingConfigElement item in cadDrawingConfig.CadDrawings)
92 | {
93 | optionDic[item.Name] = item;
94 | }
95 | Console.WriteLine(@"--------------------------------");
96 | foreach (var item in optionDic.Values)
97 | {
98 | Console.WriteLine(@"名称:{0},打印机:{1},图幅:{2},折合A4:{3}", item.Name, item.Printer, item.CanonicalMediaName, item.ForA4);
99 |
100 | }
101 | Assert.AreEqual(optionDic["A4"].Printer, "sdfasfdasfd");
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/CADPlot/TestProject1/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过下列特性集
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("TestProject1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("微软中国")]
12 | [assembly: AssemblyProduct("TestProject1")]
13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的某个类型,
19 | // 则将该类型的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("3f92f317-ee74-4d9f-a5f5-98df5d776d04")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/CADPlot/TestProject1/TestProject1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 |
7 |
8 | 2.0
9 | {02AFE1EC-F493-4014-AAA8-E7A515DB79AA}
10 | Library
11 | Properties
12 | TestProject1
13 | TestProject1
14 | v4.0
15 | 512
16 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 | 3.5
41 |
42 |
43 |
44 |
45 | False
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {C67AA93B-2685-4274-A36B-42B469FC6583}
55 | CADPlot
56 |
57 |
58 |
59 |
60 | Designer
61 | PreserveNewest
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | CadPlot
2 | =======
3 |
4 | CAD图纸批量打印
5 |
--------------------------------------------------------------------------------
/acadauto.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ypj658/CadPlot/551afb26a50a30e9bbbfd00dae5b6135cc8d18ab/acadauto.chm
--------------------------------------------------------------------------------