-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollarReplaceCmd.cs
169 lines (145 loc) · 2.61 KB
/
CollarReplaceCmd.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
using System;
using System.Runtime.InteropServices;
using ESRI.ArcGIS.Utility.CATIDs;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Framework;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.SystemUI;
using System.Windows.Forms;
namespace mdna
{
/// <summary>
/// Summary description for CollarReplaceCmd.
/// </summary>
public class CollarReplaceCmd : ICommand
{
// For the bitmap.
[DllImport("gdi32.dll")]
static extern bool DeleteObject(IntPtr hObject);
#region Data Members
private IApplication m_app;
private bool m_enabled;
private System.Drawing.Bitmap m_bitmap;
private IntPtr m_hBitmap;
#endregion
public CollarReplaceCmd()
{
m_app = null;
m_enabled = false;
/*
m_bitmap = new System.Drawing.Bitmap(GetType().Assembly.GetManifestResourceStream("mdna.preferences.bmp"));
if (m_bitmap != null)
{
m_bitmap.MakeTransparent(m_bitmap.GetPixel(0,0));
m_hBitmap = m_bitmap.GetHbitmap();
}
*/
}
~CollarReplaceCmd()
{
if (m_hBitmap.ToInt32() != 0)
DeleteObject(m_hBitmap);
}
#region ICommand Members
public void OnClick()
{
MessageBox.Show( "Not implemented yet." );
}
public string Message
{
get
{
return( "Processes the collar of the map, replacing text and adding diagrams." );
}
}
public int Bitmap
{
get
{
return( m_hBitmap.ToInt32() );
}
}
public void OnCreate(object hook)
{
if( hook != null && hook is IMxApplication )
{
m_app = (IApplication)hook;
m_enabled = true;
}
else
{
m_enabled = false;
}
}
public string Caption
{
get
{
return( "Process Collar" );
}
}
public string Tooltip
{
get
{
return( "Replaces collar elements with appropriate data." );
}
}
public int HelpContextID
{
get
{
return 0;
}
}
public string Name
{
get
{
return( "Process Collar" );
}
}
public bool Checked
{
get
{
return false;
}
}
public bool Enabled
{
get
{
return( m_enabled );
}
}
public string HelpFile
{
get
{
return null;
}
}
public string Category
{
get
{
return( "MDNA" );
}
}
#endregion
#region "Component Category Registration"
[ComRegisterFunction()]
static void Reg(string regKey)
{
MxCommands.Register(regKey);
}
[ComUnregisterFunction()]
static void Unreg(string regKey)
{
MxCommands.Unregister(regKey);
}
#endregion
}
}