添加自定义工具按钮:
1
2
//
add standard instances of stock Custom tools to the map's Tools collection
3
mapControl1.Tools.Add(
"
CustomPoint
"
,
new
CustomPointMapTool(
true
, mapControl1.Tools.FeatureViewer,
4
mapControl1.Handle.ToInt32(), mapControl1.Tools,
5
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
6
7
mapControl1.Tools.Add(
"
CustomLine
"
,
new
CustomLineMapTool(
true
,
true
,
true
,
8
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
9
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
10
11
mapControl1.Tools.Add(
"
CustomPolyline
"
,
new
CustomPolylineMapTool(
true
,
true
,
true
,
12
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
13
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
14
15
mapControl1.Tools.Add(
"
CustomPolygon
"
,
new
CustomPolygonMapTool(
true
,
true
,
true
,
16
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
17
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
18
19
mapControl1.Tools.Add(
"
CustomRectangle
"
,
new
CustomRectangleMapTool(
true
,
true
,
true
,
20
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
21
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
22
23
mapControl1.Tools.Add(
"
CustomEllipse
"
,
new
CustomEllipseMapTool(
true
,
true
,
true
,
24
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
25
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
26
27
mapControl1.Tools.Add(
"
CustomCircle
"
,
new
CustomCircleMapTool(
true
,
true
,
true
,
28
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
29
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
30
31
mapControl1.Tools.Add(
"
CustomArc
"
,
new
CustomArcMapTool(
true
,
true
,
true
,
32
mapControl1.Viewer, mapControl1.Handle.ToInt32(), mapControl1.Tools,
33
mapControl1.Tools.MouseToolProperties, mapControl1.Tools.MapToolProperties));
状态栏相关的:
1 // Set up StatusBar to show which layers allow select/edit/draw operations,
2
//
and divide available space evenly between StatusBar panels
3
statusBar1.Layers
=
mapControl1.Map.Layers;
4
statusBar1.SelectableLayerFilter
=
mapControl1.Tools.SelectMapToolProperties.SelectableLayerFilter;
5
statusBar1.EditableLayerFilter
=
mapControl1.Tools.SelectMapToolProperties.EditableLayerFilter;
6
statusBar1.InsertionLayerFilter
=
mapControl1.Tools.AddMapToolProperties.InsertionLayerFilter;
7
foreach
(StatusBarPanel p
in
statusBar1.Panels)
8
p.Width
=
174
;