//背景样式选择,调用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 ChangeDefaultSymbol_Load(object sender, EventArgs e) { FrmSymbol fsb = new FrmSymbol(SymbolStyle, (ISymbol)m_graphicProperties.MarkerSymbol, esriSymbologyStyleClass.esriStyleClassMarkerSymbols); btPoint.Image = fsb.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols, (ISymbol)m_graphicProperties.MarkerSymbol, btPoint.Width, btPoint.Height); fsb = new FrmSymbol(SymbolStyle, (ISymbol)m_graphicProperties.LineSymbol, esriSymbologyStyleClass.esriStyleClassLineSymbols); btPolyline.Image = fsb.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, (ISymbol)m_graphicProperties.LineSymbol, btPolyline.Width, btPolyline.Height); fsb = new FrmSymbol(SymbolStyle, (ISymbol)m_graphicProperties.FillSymbol, esriSymbologyStyleClass.esriStyleClassFillSymbols); btPolygon.Image = fsb.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassFillSymbols, (ISymbol)m_graphicProperties.FillSymbol, btPolygon.Width, btPolygon.Width); symbollist.Clear(); symbollist.Add(m_graphicProperties.MarkerSymbol); symbollist.Add(m_graphicProperties.LineSymbol); symbollist.Add(m_graphicProperties.FillSymbol); }
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); } }