?? c# mapx之一--黑暗之痕.htm
字號:
</SPAN>ToolsList.Add(MapXLib.ToolConstants.miTextTool);
</FONT>
<P><FONT color=#444444></FONT></P></SPAN></I></B>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><B><I><SPAN lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt"><FONT
color=#444444><SPAN
style="mso-tab-count: 1">
</SPAN>ToolsList.Add(MapXLib.ToolConstants.miZoomInTool);
</FONT>
<P><FONT color=#444444></FONT></P></SPAN></I></B>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><B><I><SPAN lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt"><FONT
color=#444444><SPAN
style="mso-tab-count: 1">
</SPAN>ToolsList.Add(MapXLib.ToolConstants.miZoomOutTool);
</FONT>
<P><FONT color=#444444></FONT></P></SPAN></I></B>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><B><I><SPAN lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt"><FONT
color=#444444> </FONT>
<P><FONT color=#444444></FONT></P></SPAN></I></B>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><B><I><SPAN lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt"><FONT
color=#444444><SPAN
style="mso-tab-count: 1">
</SPAN>comboBox1.DataSource=ToolsList; </FONT>
<P><FONT color=#444444></FONT></P></SPAN></I></B>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt"><FONT
color=#444444>}</FONT></SPAN><SPAN lang=EN-US
style="FONT-FAMILY: 宋體"><FONT color=#444444>
</FONT>
<P><FONT color=#444444></FONT></P></SPAN>
<P><FONT
color=#444444></FONT></P></TD></TR></TBODY></TABLE></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; mso-outline-level: 1"><SPAN
lang=EN-US style="FONT-FAMILY: 宋體"><FONT color=#444444
size=3> </FONT>
<P><FONT color=#444444 size=3></FONT></P></SPAN>
<P><FONT color=#444444 size=3></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT
size=3><FONT color=#444444><SPAN lang=EN-US><SPAN
style="mso-tab-count: 1"><FONT
face="Times New Roman">
</FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">以上代碼通過一個數組</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">ToolsList,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">將</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">MapXLib</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">的工具加入到</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">comboBox1</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">中</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">.MapX</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">還有一些其它的工具</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">它們的作用是往地圖上加上點</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">線</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">多邊型和圓</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">.</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">因為這些工具要求有操作圖層</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">一并在介紹圖層的時候介紹</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">.</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">關于</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">ArrayList</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">的用法</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">請參考</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">C#</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">的有關資料</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">.</FONT></SPAN></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT
size=3><FONT color=#444444><SPAN lang=EN-US><SPAN
style="mso-tab-count: 1"><FONT
face="Times New Roman">
</FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">接著</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">雙擊</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">comboBox1,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">并編寫代碼如下</SPAN></FONT></FONT></P>
<P>
<TABLE
style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid windowtext .5pt"
cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD
style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 426.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 0.5pt solid; BACKGROUND-COLOR: transparent"
vAlign=top width=568>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="COLOR: blue; FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
color=#444444>private</FONT></SPAN><SPAN
lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
color=#444444> <SPAN
style="COLOR: blue">void</SPAN>
comboBox1_SelectedIndexChanged(<SPAN
style="COLOR: blue">object</SPAN> sender,
System.EventArgs e) </FONT>
<P><FONT color=#444444></FONT></P></SPAN>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
color=#444444>{ </FONT>
<P><FONT color=#444444></FONT></P></SPAN>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none"
align=left><SPAN lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><SPAN
style="mso-tab-count: 1"><FONT
color=#444444>
</FONT></SPAN><B><I><FONT
color=#444444>axMap1.CurrentTool=(MapXLib.ToolConstants)comboBox1.SelectedItem;
</FONT>
<P><FONT color=#444444></FONT></P></I></B></SPAN>
<P><FONT color=#444444></FONT></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
color=#444444>}</FONT></SPAN></P></TD></TR></TBODY></TABLE></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT
size=3><FONT color=#444444><SPAN lang=EN-US><SPAN
style="mso-tab-count: 1"><FONT
face="Times New Roman">
</FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">應注意</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">,</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">在</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">C#</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">中必須要顯式地把</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">comboBox1</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">的選擇項目</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SelectedItem(</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">數據類型為</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">object)</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">轉換為</SPAN></FONT></FONT><SPAN
lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
color=#444444
size=3>MapXLib.ToolConstants.因為ToolConstants是MapX自己定義的一個枚舉數據類型,C#不能自動完成這種枚舉成員變量到object的數據轉換.
</FONT>
<P><FONT color=#444444 size=3></FONT></P></SPAN>
<P><FONT color=#444444 size=3></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
size=3><FONT color=#444444><SPAN
style="mso-tab-count: 1">
</SPAN>編譯執行程序,從comboBox1中選擇不同的工具,在地圖上進行操作,你可以了解到MapX工具集的強大功能.
</FONT></FONT>
<P><FONT color=#444444 size=3></FONT></P></SPAN>
<P><FONT color=#444444 size=3></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><FONT
size=3><FONT color=#444444><SPAN
style="mso-tab-count: 1">
</SPAN>實際上,MapX提供的工具集就好像Photoshop,AutoCAD的工具欄一樣,為你提供了一些控制地圖的工具.但是,在開發GIS的時候,這些工具是不能完全滿足要求的.所以,還應該學會自定義工具.
</FONT></FONT>
<P><FONT color=#444444 size=3></FONT></P></SPAN>
<P><FONT color=#444444 size=3></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US
style="FONT-FAMILY: 新宋體; mso-bidi-font-size: 9.0pt; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'"><SPAN
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -