//背景样式选择,调用FrmSy窗口 private void btBackgroundStyle_Click(object sender, EventArgs e) { if (pStyleGalleryItem != null) { ISymbolBackground pSBackground = pStyleGalleryItem.Item as ISymbolBackground; IFillSymbol pFS = pSBackground.FillSymbol; FrmSymbol Frm = new FrmSymbol(SymbolStyle, (ISymbol)pFS, esriSymbologyStyleClass.esriStyleClassFillSymbols); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { pFillSymbol = Frm.GetStyleGalleryItem().Item as IFillSymbol; this.SizeBackgroundOutline.Text = pFillSymbol.Outline.Width.ToString(); IColor pFillColor = pFillSymbol.Color; Color pColorFill = ColorTranslator.FromOle(pFillColor.RGB); colorFill.SelectedColor = pColorFill; IColor pOutlineColor = pFillSymbol.Outline.Color; Color pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB); colorOutline.SelectedColor = pColorOutline; SymbolBackground = pStyleGalleryItem.Item as ISymbolBackground; SymbolBackground.FillSymbol = pFillSymbol; PreviewImage(); } } else { MessageBox.Show("请选择一种样式!"); } }
//边框样式选择 private void btBorderStyle_Click(object sender, EventArgs e) { if (pStyleGalleryItem != null) { ISymbolBorder pSBorder = (ISymbolBorder)pStyleGalleryItem.Item; ILineSymbol pLS = pSBorder.LineSymbol; FrmSymbol Frm = new FrmSymbol(SymbolStyle, (ISymbol)pLS, esriSymbologyStyleClass.esriStyleClassLineSymbols); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { pLineSymbol = Frm.GetStyleGalleryItem().Item as ILineSymbol; this.SizeBorder.Text = pLineSymbol.Width.ToString(); IColor pLineColor = pLineSymbol.Color; Color pColor = ColorTranslator.FromOle(pLineColor.RGB); colorBorder.SelectedColor = pColor; SymbolBorder = (ISymbolBorder)pStyleGalleryItem.Item; SymbolBorder.LineSymbol = pLineSymbol; PreviewImage(); } } else { MessageBox.Show("请选择一种样式!"); } }
//箭头样式选择 private void btArrowSymbol_Click(object sender, EventArgs e) { IGraphicProperties m_GraphicProperties = new CommandsEnvironmentClass(); FrmSymbol FrmMarker = new FrmSymbol(SymbolStyle, (ISymbol)m_GraphicProperties.MarkerSymbol, esriSymbologyStyleClass.esriStyleClassMarkerSymbols); FrmMarker.ShowDialog(); if (FrmMarker.DialogResult == DialogResult.OK) { pArrowSymbol = FrmMarker.GetStyleGalleryItem() as IMarkerSymbol; } }
private void btPolygon_Click(object sender, EventArgs e) { FrmSymbol frmSymbol = new FrmSymbol(SymbolStyle, (ISymbol)m_graphicProperties.FillSymbol, esriSymbologyStyleClass.esriStyleClassFillSymbols); IStyleGalleryItem styleGalleryItem = null; frmSymbol.ShowDialog(); if (frmSymbol.DialogResult == DialogResult.OK) { styleGalleryItem = frmSymbol.GetStyleGalleryItem(); if (styleGalleryItem == null) { return; } // m_graphicProperties.FillSymbol = (IFillSymbol)styleGalleryItem.Item; symbollist[2] = styleGalleryItem.Item; btPolygon.Image = frmSymbol.GetImageByGiveSymbolAfterSelectItem(btPolygon.Width, btPolygon.Height); } }