c#+AE Toc 右键删除标注符号选择器.docx

上传人:b****4 文档编号:24450585 上传时间:2023-05-27 格式:DOCX 页数:14 大小:17.38KB
下载 相关 举报
c#+AE Toc 右键删除标注符号选择器.docx_第1页
第1页 / 共14页
c#+AE Toc 右键删除标注符号选择器.docx_第2页
第2页 / 共14页
c#+AE Toc 右键删除标注符号选择器.docx_第3页
第3页 / 共14页
c#+AE Toc 右键删除标注符号选择器.docx_第4页
第4页 / 共14页
c#+AE Toc 右键删除标注符号选择器.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

c#+AE Toc 右键删除标注符号选择器.docx

《c#+AE Toc 右键删除标注符号选择器.docx》由会员分享,可在线阅读,更多相关《c#+AE Toc 右键删除标注符号选择器.docx(14页珍藏版)》请在冰豆网上搜索。

c#+AE Toc 右键删除标注符号选择器.docx

c#+AEToc右键删除标注符号选择器

把附件代码发上来

1.usingSystem;

2.usingSystem.Collections.Generic;

3.usingSystem.ComponentModel;

4.usingSystem.Data;

5.usingSystem.Drawing;

6.usingSystem.Text;

7.usingSystem.Windows.Forms;

8.usingESRI.ArcGIS.SystemUI;

9.usingESRI.ArcGIS.Utility;

10.usingESRI.ArcGIS.Geometry;

11.usingESRI.ArcGIS.esriSystem;

12.usingESRI.ArcGIS.Display;

13.usingESRI.ArcGIS.Carto;

14.usingESRI.ArcGIS.Controls;

15.usingESRI.ArcGIS.Geodatabase;

16.usingESRI.ArcGIS.DisplayUI;

17.

18.

19.

20.

21.namespacesinba

22.{

23.publicpartialclassForm1:

Form

24.{

25.privateconstintWM_ENTERSIZEMOVE=0x231;

26.privateconstintWM_EXITSIZEMOVE=0x232;

27.boolTOCState=true;

28.boolNState=true;

29.

30.

31.privateesriTOCControlItemtoccItem=esriTOCControlItem.esriTOCControlItemNone;

32.privateILayeriLayer=null;

33.privateIBasicMapiBasicMap=null;

34.privateIFeatureLayerpFeatureLayer;

35.privateIFeatureClasspfeatureclass;

36.

37.

38.publicForm1()

39.{

40.InitializeComponent();

41.}

42.

43.privateintGetLayerindexbyName(stringlayername)

44.{

45.inti;

46.for(i=0;i

47.{

48.if(layername==axMapControl1.get_Layer(i).Name)

49.

50.break;

51.}

52.returni;

53.}

54.

55.privatevoidForm1_Load(objectsender,EventArgse)

56.{

57.this.SetStyle(ControlStyles.EnableNotifyMessage,true);

58.

59.

60.

61.//向PagLayoutControl加载一个图形文档

62.

63.stringfilename=@"E:

\铁路查询系统\地图文档\airport.mxd";

64.if(axMapControl1.CheckMxFile(filename))

65.{

66.this.axMapControl1.LoadMxFile(filename);

67.axMapControl1.Extent=axMapControl1.FullExtent;

68.

69.

70.}

71.

72.this.axTOCControl1.SetBuddyControl(axMapControl1);

73.this.axToolbarControl1.SetBuddyControl(axMapControl1);

74.this.axToolbarControl2.SetBuddyControl(axMapControl1);

75.this.axToolbarControl3.SetBuddyControl(axMapControl1);

76.

77.this.axToolbarControl3.Show();

78.this.axToolbarControl1.Show();

79.this.axToolbarControl2.Hide();

80.this.axMapControl1.Show();

81.this.axPageLayoutControl1.Hide();

82.

83.

84.}

85.

86.privatevoidaxMapControl1_OnMouseDown(objectsender,ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvente)

87.{

88.

89.}

90.

91.privatevoidaxToolbarControl1_OnMouseDown(objectsender,IToolbarControlEvents_OnMouseDownEvente)

92.{

93.if(e.button==2)

94.{

95.contextMenuStrip1.Show(axToolbarControl1,e.x,e.y);

96.}

97.

98.

99.

100.}

101.

102.

103.

104.protectedoverridevoidOnNotifyMessage(Messagem)

105.{

106.base.OnNotifyMessage(m);

107.if(m.Msg==WM_ENTERSIZEMOVE)

108.{

109.axMapControl1.SuppressResizeDrawing(true,0);

110.axPageLayoutControl1.SuppressResizeDrawing(true,0);

111.

112.}

113.elseif(m.Msg==WM_EXITSIZEMOVE)

114.{

115.axMapControl1.SuppressResizeDrawing(false,0);

116.axPageLayoutControl1.SuppressResizeDrawing(false,0);

117.

118.}

119.

120.

121.}

122.

123.privatevoidtoolStripButton1_Click(objectsender,EventArgse)

124.{

125.

126.this.axTOCControl1.SetBuddyControl(axMapControl1);

127.this.axToolbarControl1.SetBuddyControl(axMapControl1);

128.

129.this.axToolbarControl3.SetBuddyControl(axMapControl1);

130.

131.this.axToolbarControl3.Show();

132.this.axToolbarControl1.Show();

133.this.axToolbarControl2.Hide();

134.this.axMapControl1.Show();

135.this.axPageLayoutControl1.Hide();

136.

137.

138.}

139.

140.privatevoidtoolStripButton2_Click(objectsender,EventArgse)

141.{

142.

143.axPageLayoutControl1.LoadMxFile(axMapControl1.DocumentFilename);

144.this.axTOCControl1.SetBuddyControl(axPageLayoutControl1);

145.this.axTOCControl1.SetBuddyControl(axPageLayoutControl1);

146.this.axToolbarControl2.SetBuddyControl(axPageLayoutControl1);

147.this.axToolbarControl3.SetBuddyControl(axPageLayoutControl1);

148.

149.this.axPageLayoutControl1.Show();

150.this.axMapControl1.Hide();

151.this.axToolbarControl2.Show();

152.this.axToolbarControl3.Show();

153.this.axToolbarControl1.Hide();

154.

155.}

156.

157.privatevoidForm1_Resize(objectsender,EventArgse)

158.{

159.

160.axTOCControl1.Left=0;

161.axTOCControl1.Top=axToolbarControl1.Height;

162.axTOCControl1.Width=Size.Width*1/6;

163.axTOCControl1.Height=Size.Height;

164.

165.

166.axPageLayoutControl1.Left=Size.Width*1/6;

167.axPageLayoutControl1.Top=0;

168.axPageLayoutControl1.Width=Size.Width*5/6;

169.axPageLayoutControl1.Height=Size.Height-axToolbarControl1.Height;

170.

171.

172.

173.

174.axMapControl1.Left=Size.Width*1/6;

175.axMapControl1.Top=0;

176.axMapControl1.Width=Size.Width*6/7;

177.axMapControl1.Height=Size.Height-axToolbarControl1.Height;

178.

179.

180.axToolbarControl1.Width=Size.Width;

181.axToolbarControl2.Width=Size.Width;

182.axToolbarControl3.Left=Size.Width*1/6;

183.axToolbarControl3.Height=Size.Height*5/6;

184.this.toolStrip1.Left=Size.Width*1/6;

185.this.toolStrip1.Top=Size.Height*7/8;

186.

187.}

188.

189.privatevoidtOCToolStripMenuItem_Click(objectsender,EventArgse)

190.{

191.if(TOCState==true)

192.{

193.axTOCControl1.Hide();

194.TOCState=false;

195.

196.}

197.else

198.{

199.axTOCControl1.Show();

200.TOCState=true;

201.}

202.

203.

204.

205.

206.if(NState==true)

207.{

208.axToolbarControl3.Hide();

209.NState=false;

210.}

211.else

212.{

213.axToolbarControl3.Show();

214.NState=true;

215.}

216.

217.

218.}

219.

220.

221.privatevoidsymbolshow_Clicked(objectsender,EventArgse)

222.{

223.IGeoFeatureLayerpGeoFeatureLayer=iLayerasIGeoFeatureLayer;

224.pGeoFeatureLayer.AnnotationProperties.Clear();//必须执行,因为里面有一个默认的

225.IBasicOverposterLayerPropertiespBasic=newBasicOverposterLayerPropertiesClass();

226.ILabelEngineLayerPropertiespLableEngine=newLabelEngineLayerPropertiesClass();

227.ITextSymbolpTextSymbol=newTextSymbolClass();

228.pTextSymbol.Color.RGB=255;

229.stringpLable="["+sender.ToString()+"]";

230.pLableEngine.Expression=pLable;

231.pLableEngine.IsExpressionSimple=true;

232.pBasic.NumLabelsOption=esriBasicNumLabelsOption.esriOneLabelPerShape;

233.pLableEngine.BasicOverposterLayerProperties=pBasic;

234.pLableEngine.Symbol=pTextSymbol;

235.pGeoFeatureLayer.AnnotationProperties.Add(pLableEngineasIAnnotateLayerProperties);

236.pGeoFeatureLayer.DisplayAnnotation=true;

237.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics,null,null);

238.

239.}

240.

241.privatevoid删除图层ToolStripMenuItem_Click(objectsender,EventArgse)

242.{

243.axMapControl1.Map.DeleteLayer(iLayer);

244.}

245.

246.privatevoidAllLayerVisibleToolStripMenuItem_Click(objectsender,EventArgse)

247.{

248.for(inti=0;i<=axMapControl1.Map.LayerCount-1;i++)

249.{

250.axMapControl1.ActiveView.FocusMap.get_Layer(i).Visible=true;

251.}

252.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null);

253.}

254.

255.privatevoidAllLayerInvisibleToolStripMenuItem_Click(objectsender,EventArgse)

256.{

257.for(inti=0;i<=axMapControl1.Map.LayerCount-1;i++)

258.{

259.axMapControl1.ActiveView.FocusMap.get_Layer(i).Visible=false;

260.}

261.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography,null,null);

262.}

263.

264.privatevoidaxTOCControl1_OnMouseDown(objectsender,ITOCControlEvents_OnMouseDownEvente)

265.{

266.objectunk=null;

267.objectdata=null;

268.if(e.button==2)

269.{

270.axTOCControl1.HitTest(e.x,e.y,reftoccItem,refiBasicMap,refiLayer,refunk,refdata);

271.

272.

273.if(toccItem==esriTOCControlItem.esriTOCControlItemLayer)

274.{

275.

276.pFeatureLayer=iLayerasIFeatureLayer;

277.pfeatureclass=pFeatureLayer.FeatureClass;

278.SymbolToolStripMenuItem.DropDownItems.Clear();

279.for(inti=0;i

280.{

281.SymbolToolStripMenuItem.DropDownItems.Add(pfeatureclass.Fields.get_Field(i).Name,null,newEventHandler(this.symbolshow_Clicked));

282.}

283.contextMenuStrip2.Show(axTOCControl1,newSystem.Drawing.Point(e.x,e.y));

284.

285.}

286.elseif(toccItem==esriTOCControlItem.esriTOCControlItemMap)

287.{

288.contextMenuStrip3.Show(axTOCControl1,newSystem.Drawing.Point(e.x,e.y));

289.}

290.

291.

292.}

293.}

294.

295.privatevoidaxTOCControl1_OnDoubleClick(objectsender,ITOCControlEvents_OnDoubleClickEvente)

296.{

297.objectunk=null;

298.objectdata=null;

299.if(e.button==1)

300.{

301.axTOCControl1.HitTest(e.x,e.y,reftoccItem,refiBasicMap,refiLayer,refunk,refdata);

302.System.Drawing.Pointpos=newSystem.Drawing.Point(e.x,e.y);

303.if(this.toccItem==esriTOCControlItem.esriTOCControlItemLegendClass)

304.{

305.ESRI.ArcGIS.Carto.ILegendClasspLC=newLegendClassClass();

306.ESRI.ArcGIS.Carto.ILegendGrouppLG=newLegendGroupClass();

307.if(unkisILegendGroup)

308.{

309.pLG=(ILegendGroup)unk;

310.}

311.pLC=pLG.get_Class((int)data);

312.ISymbolpSym;

313.pSym=pLC.Symbol;

314.ESRI.ArcGIS.DisplayUI.ISymbolSelectorpSS=newESRI.ArcGIS.DisplayUI.SymbolSelectorClass();

315.boolbOK=false;

316.pSS.AddSymbol(pSym);

317.bOK=pSS.SelectSymbol(0);

318.if(bOK)

319.{

320.pLC.Symbol=pSS.GetSymbolAt(0);

321.}

322.this.axMapControl1.ActiveView.Refresh();

323.this.axTOCControl1.Refresh();

324.}

325.}

326.

327.}

328.

329.

330.}

331.}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1