private void styleToolStripMenuItem_Click(object sender, EventArgs e) { IStyleGallery pStyleGlry = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleStorage = pStyleGlry as IStyleGalleryStorage; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = 255; pRgbColor.Green = 1; pRgbColor.Blue = 2; IStyleGalleryItem pStyleItem = new ServerStyleGalleryItemClass(); pStyleItem.Name = "Red"; pStyleItem.Category = "Default"; pStyleItem.Item = pRgbColor; string pOldFile = pStyleStorage.TargetFile; pStyleStorage.TargetFile = @"E:\test.style"; pStyleGlry.AddItem(pStyleItem); pStyleStorage.TargetFile = pOldFile; IColor color = pRgbColor as IColor; this.Text = color.RGB.ToString(); }
private void ChangeSymbol(DevComponents.DotNetBar.Controls.ComboBoxEx cmb, Color pColor, esriSymbologyStyleClass styleClass) { try { DevComponents.Editors.ComboItem item = cmb.SelectedItem as DevComponents.Editors.ComboItem; object obj = item.Tag; if (obj == null) { return; } IFrameDecoration pFrameDecoration = (IFrameDecoration)obj; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = pColor.R; pRgbColor.Green = pColor.G; pRgbColor.Blue = pColor.B; pFrameDecoration.Color = (IColor)pRgbColor; IStyleGalleryItem pItem = new ServerStyleGalleryItemClass(); pItem.Name = "temp"; pItem.Item = pFrameDecoration; stdole.IPictureDisp picture; System.Drawing.Image image; ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(styleClass); picture = symbologyStyleClass.PreviewItem(pItem, cmb.Width - 80, cmb.Height); image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle)); item.Image = image; } catch { } }
/// <summary> /// 预览符号,根据Symbol /// </summary> /// <param name="vSymbol"></param> private void PreviewSymbol(ISymbol vSymbol) { ISymbologyStyleClass pSymbologyStyleClass; IStyleGalleryItem pStyleGalleryItem; stdole.IPictureDisp ppicdisp; Image pImage; try { pSymbologyStyleClass = this.SymbolCtrl1.GetStyleClass(this.SymbolCtrl1.StyleClass); pStyleGalleryItem = new ServerStyleGalleryItemClass(); pStyleGalleryItem.Item = vSymbol; this.SymbolCtrl1.Update(); ppicdisp = pSymbologyStyleClass.PreviewItem(pStyleGalleryItem, this.pbPreview.Width, this.pbPreview.Height); pImage = Image.FromHbitmap(new System.IntPtr(ppicdisp.Handle)); this.pbPreview.Image = null; this.pbPreview.Image = pImage; } catch (Exception ex) { //ModDeclare.g_ErrorHandler.DisplayInformation("frmSymboManager的PreviewSymbol出错:" + ex.Message, false, null, null); MessageBox.Show("frmSymboManager的PreviewSymbol出错:" + ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } }
private void DrawColorRamp() { string strDefaultStyleFileName = string.Format("{0}\\CNUStyles\\ESRI.ServerStyle", Application.StartupPath); IStyleGallery styleGallery = new ServerStyleGalleryClass(); IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); IStyleGalleryStorage styleGalleryStorage = styleGallery as IStyleGalleryStorage; styleGalleryStorage.AddFile(strDefaultStyleFileName); IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Color Ramps", strDefaultStyleFileName, ""); enumStyleGalleryItem.Reset(); styleGalleryItem = enumStyleGalleryItem.Next(); while (styleGalleryItem != null) { m_ColorRamp = (IColorRamp)styleGalleryItem.Item; EnumStyleItem.Add(m_ColorRamp); //新建m_FillSymbol和m_colorRamp m_FillSymbol = new GradientFillSymbol(); m_FillSymbol.GradientPercentage = 1; m_FillSymbol.IntervalCount = 255; m_FillSymbol.GradientAngle = 0; m_FillSymbol.ColorRamp = m_ColorRamp; pictureBox1.Image = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height); pictureBox2.Image = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height); imageList1.Images.Add(m_ColorRamp.Name, pictureBox1.Image); imageList2.Images.Add(m_ColorRamp.Name, pictureBox1.Image); colorComboBox.Items.Add(pictureBox1.Image); colorComboBox1.Items.Add(pictureBox2.Image); styleGalleryItem = enumStyleGalleryItem.Next(); } }
//添加GLISTBOX项 private void addListBoxItem(ISymbol symbol) { IStyleGallery styleGallery; IStyleGalleryItem styleGalleryItem; IStyleGalleryStorage styleGalleryStorge; styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = this.txtSymbolName.Text; styleGalleryItem.Category = "default"; object objSymbol = symbol; styleGalleryItem.Item = objSymbol; styleGallery = new ServerStyleGalleryClass(); styleGalleryStorge = styleGallery as IStyleGalleryStorage; styleGalleryStorge.TargetFile = fileName; //IStyleGalleryClass styleGalleryClass = styleGallery.get_Class(CurrentStyleGalleryClassIndex); ISymbologyStyleClass pSymbolClass = psymbologyStyleClass; pSymbolClass.AddItem(styleGalleryItem, 0); pSymbolClass.SelectItem(0); stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(styleGalleryItem, 140, 20); Image image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle)); GridPanel panel = supergrid.PrimaryGrid; GridRow row = new GridRow(image); panel.Rows.Add(row); psymbologyStyleClass.RemoveItem(0); imagelist.Add(image); }
private void InitControl() { this.m_CanDo = false; this.numericUpDownAngle.Value = (decimal)this.m_GradientFillSymbol.GradientAngle; this.numericUpDownPrecent.Value = (decimal)(this.m_GradientFillSymbol.GradientPercentage * 100.0); this.numericUpDownIntervalCount.Value = this.m_GradientFillSymbol.IntervalCount; this.cboGradientFillStyle.SelectedIndex = (int)this.m_GradientFillSymbol.Style; this.btnOutline.Style = this.m_GradientFillSymbol.Outline; IStyleGalleryItem item = new ServerStyleGalleryItemClass { Item = this.m_GradientFillSymbol.ColorRamp }; this.colorRampComboBox.Add(item); if (this.m_pSG != null) { IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", ""); item2.Reset(); for (item = item2.Next(); item != null; item = item2.Next()) { this.colorRampComboBox.Add(item); } item2 = null; GC.Collect(); } if (this.colorRampComboBox.Items.Count > 0) { this.colorRampComboBox.SelectedIndex = 0; } this.m_CanDo = true; }
private void ChangeLineSymbol() { ILineSymbol pLineSymbol = grpSymbol.Tag as ILineSymbol; if (pLineSymbol == null) { return; } Color pColor = colorLine.Color; pLineSymbol.Color = PublicClass.GetRGBColor(colorLine); pLineSymbol.Width = (double)numLineWidth.Value; ILineProperties pLineProp = pLineSymbol as ILineProperties; if (pLineProp != null) { pLineProp.Offset = (double)numLineOffSet.Value; } grpSymbol.Tag = pLineSymbol; IStyleGalleryItem item = new ServerStyleGalleryItemClass(); item.Name = "tempSymbol"; item.Item = pLineSymbol; PreviewImage(item); m_styleGalleryItem = item; }
private void ChangeMrkSymbol() { IMarkerSymbol pMrkSymbol = grpSymbol.Tag as IMarkerSymbol; if (pMrkSymbol == null) { return; } pMrkSymbol.Size = (double)numPtSize.Value; Color pColor = colorPoint.Color; pMrkSymbol.Color = PublicClass.GetRGBColor(colorPoint); pMrkSymbol.XOffset = (double)numPtXOffSet.Value; pMrkSymbol.YOffset = (double)numPtYOffSet.Value; grpSymbol.Tag = pMrkSymbol; IStyleGalleryItem item = new ServerStyleGalleryItemClass(); item.Name = "tempSymbol"; item.Item = pMrkSymbol; PreviewImage(item); m_styleGalleryItem = item; }
private void axPageLayoutControl1_OnPageLayoutReplaced(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { //Get the frame containing the focus map IFrameProperties frameProperties = (IFrameProperties)axPageLayoutControl1.GraphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap); //Create a new ServerStyleGalleryItem with its name set IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = "myStyle"; ISymbologyStyleClass styleClass; //Get the background style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBackgrounds); if (styleClass.GetItem(0).Name == "myStyle") { styleClass.RemoveItem(0); } if (frameProperties.Background != null) { //Set the background into the style gallery item styleGalleryItem.Item = frameProperties.Background; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } //Get the border style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBorders); if (styleClass.GetItem(0).Name == "myStyle") { styleClass.RemoveItem(0); } if (frameProperties.Border != null) { //Set the border into the style gallery item styleGalleryItem.Item = frameProperties.Border; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } //Get the shadow style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassShadows); if (styleClass.GetItem(0).Name == "myStyle") { styleClass.RemoveItem(0); } if (frameProperties.Shadow != null) { //Set the shadow into the style gallery item styleGalleryItem.Item = frameProperties.Shadow; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } }
private System.Drawing.Image Symbol2Picture(object pSymbol, int width, int height) { if (pSymbol == null || width < 1 || height < 1) { return(null); } if (pSymbol is IMarkerSymbol) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassMarkerSymbols; } else if (pSymbol is ILineSymbol) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassLineSymbols; } else if (pSymbol is IFillSymbol) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassFillSymbols; } else if (pSymbol is ITextSymbol) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassTextSymbols; } else if (pSymbol is INorthArrow) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassNorthArrows; } else if (pSymbol is IScaleBar) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassScaleBars; } else if (pSymbol is IScaleText) { axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassScaleTexts; } ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass); symbologyStyleClass.RemoveAll(); IStyleGalleryItem pStyleItem = new ServerStyleGalleryItemClass(); pStyleItem.Name = "tempSymbol"; pStyleItem.Item = pSymbol; //symbologyStyleClass.AddItem(pStyleItem, 0); stdole.IPictureDisp picture = symbologyStyleClass.PreviewItem(pStyleItem, width, height); if (pSymbol is IScaleBar) { picture = symbologyStyleClass.PreviewItem(pStyleItem, width * 2, height); } else if (pSymbol is IScaleText) { picture = symbologyStyleClass.PreviewItem(pStyleItem, width * 2, height); } System.Drawing.Image image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle)); return(image); }
private void DisplayAdvancePage_Load(object sender, EventArgs e) { if (this.m_pGpsDisplayProperties != null) { IStyleGalleryItem item; this.chkShowCurrentAltitude.Checked = this.m_pGpsDisplayProperties.ShowCurrentAltitude; this.chkShowCurrentBearing.Checked = this.m_pGpsDisplayProperties.ShowCurrentBearing; this.chkShowCurrentSpeed.Checked = this.m_pGpsDisplayProperties.ShowCurrentSpeed; this.chkShowMarkerTrailAltitude.Checked = this.m_pGpsDisplayProperties.ShowMarkerTrailAltitude; this.chkShowMarkerTrailBearing.Checked = this.m_pGpsDisplayProperties.ShowMarkerTrailBearing; this.chkShowMarkerTrailSpeed.Checked = this.m_pGpsDisplayProperties.ShowMarkerTrailSpeed; this.txtHighAltitudeSize.Text = this.m_pGpsDisplayProperties.HighAltitudeSize.ToString(); this.txtHighAltitudeValue.Text = this.m_pGpsDisplayProperties.HighAltitudeValue.ToString(); this.txtLowAltitudeSize.Text = this.m_pGpsDisplayProperties.LowAltitudeSize.ToString(); this.txtLowAltitudeValue.Text = this.m_pGpsDisplayProperties.LowAltitudeValue.ToString(); this.txtLowSpeedValue.Text = this.m_pGpsDisplayProperties.LowSpeedValue.ToString(); this.lblMaxAltituteUnit.Text = CommonHelper.GetUnit(this.m_pGpsDisplayProperties.AltitudeUnits); this.lblMinAltituteUnit.Text = this.lblMaxAltituteUnit.Text; this.lblMaxSpeedUnit.Text = this.GetSpeedUnitDescription(this.m_pGpsDisplayProperties.SpeedUnits); this.lblMinSpeedUnit.Text = this.lblMaxSpeedUnit.Text; if (this.m_pGpsDisplayProperties.SpeedColorRamp != null) { item = new ServerStyleGalleryItemClass { Item = this.m_pGpsDisplayProperties.SpeedColorRamp }; this.cboSpeedColorRamp.Add(item); } if (this.m_pSG != null) { IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", ""); item2.Reset(); for (item = item2.Next(); item != null; item = item2.Next()) { this.cboSpeedColorRamp.Add(item); } item2 = null; GC.Collect(); } if (this.cboSpeedColorRamp.Items.Count > 0) { this.cboSpeedColorRamp.SelectedIndex = 0; } else { this.cboSpeedColorRamp.Enabled = false; } this.m_CanDo = true; } }
//添加GLISTBOX项 private void addListBoxItem(ISymbol symbol) { IStyleGallery styleGallery; IStyleGalleryItem styleGalleryItem; IStyleGalleryStorage styleGalleryStorge; styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = this.txtSymbolName.Text; styleGalleryItem.Category = "default"; object objSymbol = symbol; styleGalleryItem.Item = objSymbol; styleGallery = new ServerStyleGalleryClass(); styleGalleryStorge = styleGallery as IStyleGalleryStorage; styleGalleryStorge.TargetFile = fileName; ISymbologyStyleClass pSymbolClass = psymbologyStyleClass; pSymbolClass.AddItem(styleGalleryItem, 0); pSymbolClass.SelectItem(0); Image image = null; if (symbol is IMarker3DSymbol) { IMarker3DSymbol mar3dsym = symbol as IMarker3DSymbol; stdole.IPicture pic = mar3dsym.Thumbnail; image = Image.FromHbitmap(new System.IntPtr(pic.Handle)); } else { stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(styleGalleryItem, 140, 15); image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle)); } GridPanel panel = supergrid.PrimaryGrid; GridRow row = new GridRow(image); panel.Rows.Add(row); psymbologyStyleClass.RemoveItem(0); imagelist.Add(image); Symbollist.Add(symbol); }
private void TrailsSetCtrl_Load(object sender, EventArgs e) { if (this.m_pPositionTrails != null) { IStyleGalleryItem item; this.chkLineTrail.Checked = this.m_pPositionTrails.ShowLinearTrail; this.chkPointTrail.Checked = this.m_pPositionTrails.ShowMarkerTrails; this.btnLineSymbol.Style = this.m_pPositionTrails.LinearTrailSymbol; this.btnPointSymbol.Style = this.m_pPositionTrails.MarkerTrailSymbol; this.txtDistance.Text = this.m_pPositionTrails.MarkerTrailDistance.ToString(); this.txtPointNum.Text = this.m_pPositionTrails.MarkerTrailCount.ToString(); this.txtLineLength.Text = this.m_pPositionTrails.LinearTrailDistance.ToString(); if (this.m_pPositionTrails.MarkerTrailColorRamp != null) { item = new ServerStyleGalleryItemClass { Item = this.m_pPositionTrails.MarkerTrailColorRamp }; this.cboSpeedColorRamp.Add(item); } if (this.m_pSG != null) { IEnumStyleGalleryItem item2 = this.m_pSG.get_Items("Color Ramps", "", ""); item2.Reset(); for (item = item2.Next(); item != null; item = item2.Next()) { this.cboSpeedColorRamp.Add(item); } item2 = null; GC.Collect(); } if (this.cboSpeedColorRamp.Items.Count > 0) { this.cboSpeedColorRamp.SelectedIndex = 0; } else { this.cboSpeedColorRamp.Enabled = false; } this.m_CanDo = true; } }
private void ChangeFillSymbol() { IFillSymbol pFillSymbol = grpSymbol.Tag as IFillSymbol; if (pFillSymbol == null) { return; } Color pColor = colorPolygon.Color; pFillSymbol.Color = PublicClass.GetRGBColor(colorPolygon); if (numOutLineWidth.Value < (decimal)0.01) { if (pFillSymbol.Outline != null) { pFillSymbol.Outline.Width = 0; } } else { ISimpleLineSymbol pOutLine = new SimpleLineSymbolClass(); pColor = colorBorder.Color; pOutLine.Color = PublicClass.GetRGBColor(colorBorder); pOutLine.Width = (double)numOutLineWidth.Value; pOutLine.Style = esriSimpleLineStyle.esriSLSSolid; pFillSymbol.Outline = (ILineSymbol)pOutLine; } grpSymbol.Tag = pFillSymbol; IStyleGalleryItem item = new ServerStyleGalleryItemClass(); item.Name = "tempSymbol"; item.Item = pFillSymbol; PreviewImage(item); m_styleGalleryItem = item; }
private static IStyleGalleryItem3 ConvertMarkerItemToRep(IStyleGalleryItem3 inputItem) { IMarkerSymbol markerSymbol = inputItem.Item as IMarkerSymbol; IRepresentationRule repRule = new RepresentationRuleClass(); IRepresentationRuleInit repRuleInit = repRule as IRepresentationRuleInit; repRuleInit.InitWithSymbol((ISymbol)markerSymbol); //initialize the rep rule with the marker IRepresentationGraphics representationGraphics = new RepresentationMarkerClass(); IGraphicAttributes graphicAttributes = null; IRepresentationGraphics tempMarkerGraphics = null; IGeometry tempGraphicGeometry = null; IRepresentationRule tempRule = null; //only pull the markers out. for (int i = 0; i < repRule.LayerCount; i++) { graphicAttributes = repRule.get_Layer(i) as IGraphicAttributes; tempMarkerGraphics = graphicAttributes.get_Value((int)esriGraphicAttribute.esriGAMarker) as IRepresentationGraphics; tempMarkerGraphics.Reset(); tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule); while (tempRule != null && tempGraphicGeometry != null) { representationGraphics.Add(tempGraphicGeometry, tempRule); tempGraphicGeometry = null; tempRule = null; tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule); } } IStyleGalleryItem3 newMarkerStyleGalleryItem = new ServerStyleGalleryItemClass(); newMarkerStyleGalleryItem.Item = representationGraphics; newMarkerStyleGalleryItem.Name = inputItem.Name; newMarkerStyleGalleryItem.Category = inputItem.Category; newMarkerStyleGalleryItem.Tags = inputItem.Tags.Replace(";emf", ""); //strip emf from the tags return(newMarkerStyleGalleryItem); }
private static IStyleGalleryItem3 ConvertMarkerItemToRep(IStyleGalleryItem3 inputItem) { IMarkerSymbol markerSymbol = inputItem.Item as IMarkerSymbol; IRepresentationRule repRule = new RepresentationRuleClass(); IRepresentationRuleInit repRuleInit = repRule as IRepresentationRuleInit; repRuleInit.InitWithSymbol((ISymbol)markerSymbol); //initialize the rep rule with the marker IRepresentationGraphics representationGraphics = new RepresentationMarkerClass(); IGraphicAttributes graphicAttributes = null; IRepresentationGraphics tempMarkerGraphics = null; IGeometry tempGraphicGeometry = null; IRepresentationRule tempRule = null; //only pull the markers out. for (int i = 0; i < repRule.LayerCount; i++) { graphicAttributes = repRule.get_Layer(i) as IGraphicAttributes; tempMarkerGraphics = graphicAttributes.get_Value((int)esriGraphicAttribute.esriGAMarker) as IRepresentationGraphics; tempMarkerGraphics.Reset(); tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule); while (tempRule != null && tempGraphicGeometry != null) { representationGraphics.Add(tempGraphicGeometry, tempRule); tempGraphicGeometry = null; tempRule = null; tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule); } } IStyleGalleryItem3 newMarkerStyleGalleryItem = new ServerStyleGalleryItemClass(); newMarkerStyleGalleryItem.Item = representationGraphics; newMarkerStyleGalleryItem.Name = inputItem.Name; newMarkerStyleGalleryItem.Category = inputItem.Category; newMarkerStyleGalleryItem.Tags = inputItem.Tags.Replace(";emf", ""); //strip emf from the tags return newMarkerStyleGalleryItem; }
private void PreViewCustom(DevComponents.DotNetBar.Controls.ComboBoxEx cmb, object item, esriSymbologyStyleClass styleClass) { IStyleGalleryItem pStyleItem = new ServerStyleGalleryItemClass(); pStyleItem.Name = "Custom"; pStyleItem.Item = item; stdole.IPictureDisp picture; System.Drawing.Image image; ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(styleClass); picture = symbologyStyleClass.PreviewItem(pStyleItem, cmb.Width - 80, cmb.Height); image = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle)); DevComponents.Editors.ComboItem valueItem; valueItem = new DevComponents.Editors.ComboItem(); valueItem.Text = "Custom"; valueItem.Tag = item; valueItem.Image = image; cmb.Items.Add(valueItem); cmb.SelectedIndex = cmb.Items.Count - 1; }
/// <summary> /// 在SymbolControl里显示当前Symbol所在的目录,并预览当前Symbol /// </summary> /// <param name="vSymbologyStyleClass"></param> private void ShowStyleItem(esriSymbologyStyleClass vSymbologyStyleClass) { IStyleGalleryItem pStyleGalleryItem; ISymbologyStyleClass pSymbologyStyleClass; try { //定义新的ServerStyleGalleryItem,将当前符号赋值给它 pStyleGalleryItem = new ServerStyleGalleryItemClass(); pStyleGalleryItem.Item = m_CurSymbol; pStyleGalleryItem.Name = m_SymbolXmlElement.GetAttribute("符号名"); m_SelStyleGalleryItem = pStyleGalleryItem; //ISymbologyStyleClass,得到SymbolControl的StyleClass pSymbologyStyleClass = this.SymbolCtrl1.GetStyleClass(vSymbologyStyleClass); pSymbologyStyleClass.AddItem(pStyleGalleryItem, 0); pSymbologyStyleClass.SelectItem(0); } catch (Exception ex) { //ModDeclare.g_ErrorHandler.DisplayInformation("frmSymboManager的ShowStyleItem出错:" + ex.Message, false, null, null); MessageBox.Show("frmSymboManager的ShowStyleItem出错:" + ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } }
private void styleToolStripMenuItem_Click(object sender, EventArgs e) { IStyleGallery pStyleGlry = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleStorage = pStyleGlry as IStyleGalleryStorage; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = 255; pRgbColor.Green = 1; pRgbColor.Blue = 2; IStyleGalleryItem pStyleItem = new ServerStyleGalleryItemClass(); pStyleItem.Name = "Red"; pStyleItem.Category = "Default"; pStyleItem.Item = pRgbColor; string pOldFile = pStyleStorage.TargetFile; pStyleStorage.TargetFile = @"E:\test.style"; pStyleGlry.AddItem(pStyleItem); pStyleStorage.TargetFile = pOldFile; IColor color = pRgbColor as IColor; this.Text = color.RGB.ToString(); }
private void btnConvert_Click(object sender, EventArgs e) { if (this.listBox1.Items.Count == 0) { MessageBox.Show("请选择要转换的源符号库"); } else if (this.txtDest.Text.Length == 0) { MessageBox.Show("请输入转出目录"); } else { IStyleGallery gallery; int num3; string str; SaveFileDialog dialog = new SaveFileDialog { FileName = this.txtDest.Text }; Stream stream = dialog.OpenFile(); if (stream != null) { Stream manifestResourceStream; int num; if (!this.m_IsStyleFile) { manifestResourceStream = base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.style"); } else { manifestResourceStream = base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.ServerStyle"); } byte[] buffer = new byte[4096]; while ((num = manifestResourceStream.Read(buffer, 0, 4096)) > 0) { stream.Write(buffer, 0, num); } stream.Close(); } if (this.m_IsStyleFile) { gallery = new ServerStyleGalleryClass(); num3 = (gallery as IStyleGalleryStorage).FileCount - 1; while (num3 >= 0) { str = (gallery as IStyleGalleryStorage).get_File(num3); (gallery as IStyleGalleryStorage).RemoveFile(str); num3--; } } else { gallery = new MyStyleGallery(); } gallery.Clear(); (gallery as IStyleGalleryStorage).TargetFile = this.txtDest.Text; foreach (object obj2 in this.listBox1.Items) { try { IStyleGallery gallery2; if (this.m_IsStyleFile) { gallery2 = new MyStyleGallery(); } else { gallery2 = new ServerStyleGalleryClass(); num3 = (gallery2 as IStyleGalleryStorage).FileCount - 1; while (num3 >= 0) { str = (gallery2 as IStyleGalleryStorage).get_File(num3); (gallery2 as IStyleGalleryStorage).RemoveFile(str); num3--; } } gallery2.Clear(); (gallery2 as IStyleGalleryStorage).AddFile(obj2.ToString()); for (num3 = 0; num3 < gallery2.ClassCount; num3++) { string name = gallery2.get_Class(num3).Name; IEnumBSTR mbstr = gallery2.get_Categories(name); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(obj2.ToString()); mbstr.Reset(); for (string str4 = mbstr.Next(); str4 != null; str4 = mbstr.Next()) { IEnumStyleGalleryItem item = gallery2.get_Items(name, obj2.ToString(), str4); item.Reset(); IStyleGalleryItem item2 = null; try { item2 = item.Next(); } catch { } while (item2 != null) { string str6; if (this.m_IsStyleFile) { IStyleGalleryItem item3 = new ServerStyleGalleryItemClass(); object obj3 = item2.Item; item3.Item = obj3; string str5 = item2.Name; item3.Name = str5; if (item2.Category.Length > 0) { str6 = fileNameWithoutExtension + "_" + item2.Category; item3.Category = str6; } else { item3.Category = fileNameWithoutExtension; } try { string defaultStylePath = (gallery as IStyleGalleryStorage).DefaultStylePath; int fileCount = (gallery as IStyleGalleryStorage).FileCount; gallery.AddItem(item3); } catch (Exception) { } } else { if (item2.Category.Length > 0) { str6 = fileNameWithoutExtension + "_" + item2.Category; item2.Category = str6; } else { item2.Category = fileNameWithoutExtension; } gallery.AddItem(item2); } try { item2 = item.Next(); } catch { } } } } (gallery2 as IStyleGalleryStorage).RemoveFile(obj2.ToString()); } catch (Exception) { } } try { (gallery as IStyleGalleryStorage).RemoveFile(this.txtDest.Text); } catch { } base.Close(); } }
private void axPageLayoutControl1_OnPageLayoutReplaced(object sender, ESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnPageLayoutReplacedEvent e) { //Get the frame containing the focus map IFrameProperties frameProperties = (IFrameProperties) axPageLayoutControl1.GraphicsContainer.FindFrame(axPageLayoutControl1.ActiveView.FocusMap); //Create a new ServerStyleGalleryItem with its name set IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = "myStyle"; ISymbologyStyleClass styleClass; //Get the background style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBackgrounds); if (styleClass.GetItem(0).Name == "myStyle") styleClass.RemoveItem(0); if (frameProperties.Background != null) { //Set the background into the style gallery item styleGalleryItem.Item = frameProperties.Background; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } //Get the border style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassBorders); if (styleClass.GetItem(0).Name == "myStyle") styleClass.RemoveItem(0); if (frameProperties.Border != null) { //Set the border into the style gallery item styleGalleryItem.Item = frameProperties.Border; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } //Get the shadow style class and remove any custom style styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassShadows); if (styleClass.GetItem(0).Name == "myStyle") styleClass.RemoveItem(0); if (frameProperties.Shadow != null) { //Set the shadow into the style gallery item styleGalleryItem.Item = frameProperties.Shadow; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); } }
private void ChangeTextSymbol() { ITextSymbol pTextSymbol = grpSymbol.Tag as ITextSymbol; if (pTextSymbol == null) { return; } //得到注记颜色 System.Drawing.Color pColor = btnTextColor.BackColor; pColor = colorAnno.Color; if (colorAnno.Color == Color.Transparent) { pTextSymbol.Color.Transparency = 0; } else { pTextSymbol.Color.Transparency = 255; } pTextSymbol.Color = PublicClass.GetRGBColor(pColor.R, pColor.G, pColor.B); //得到注记字体格式 stdole.IFontDisp pFontDisp = (stdole.IFontDisp)(new stdole.StdFontClass()); pFontDisp.Name = cmbTextFont.Text; pFontDisp.Bold = toolBarStyle.Buttons["toolBlod"].Pushed; pFontDisp.Italic = toolBarStyle.Buttons["toolItalic"].Pushed; pFontDisp.Underline = toolBarStyle.Buttons["toolUnderline"].Pushed; pFontDisp.Size = numTextSize.Value; pTextSymbol.Font = pFontDisp; //得到注记对齐格式 if (toolBarAlign.Buttons["toolLeft"].Pushed) { pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; } else if (toolBarAlign.Buttons["toolCenter"].Pushed) { pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; } else if (toolBarAlign.Buttons["toolRight"].Pushed) { pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHARight; } else { pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull; } pTextSymbol.Angle = (double)anGle.Value; //设置背景 IFormattedTextSymbol pFTextSymbol = pTextSymbol as IFormattedTextSymbol; if (pFTextSymbol != null) { if (pFTextSymbol.Background != null) { if (pFTextSymbol.Background is IBalloonCallout) { IBalloonCallout pBallCallout = pFTextSymbol.Background as IBalloonCallout; IFillSymbol pFillSymbol = pBallCallout.Symbol; if (pFillSymbol != null) { pFillSymbol.Color = PublicClass.GetRGBColor(l_ColorForPolygon.BackColor.R, l_ColorForPolygon.BackColor.G, l_ColorForPolygon.BackColor.B); ILineSymbol pLineSymbol = pFillSymbol.Outline; if (pLineSymbol != null) { pLineSymbol.Color = PublicClass.GetRGBColor(l_ColorForLine.ForeColor.R, l_ColorForLine.ForeColor.G, l_ColorForLine.ForeColor.B); if (!string.IsNullOrEmpty(txt_LineWidth.Text)) { pLineSymbol.Width = double.Parse(txt_LineWidth.Text); } pFillSymbol.Outline = pLineSymbol; } } } } } grpSymbol.Tag = pTextSymbol; IStyleGalleryItem item = new ServerStyleGalleryItemClass(); item.Name = "tempSymbol"; item.Item = pTextSymbol; PreviewImage(item); m_styleGalleryItem = item; }
private void btnConvert_Click(object sender, EventArgs e) { if (this.listBox1.Items.Count == 0) { MessageBox.Show("请选择要转换的源符号库"); } else if (this.txtDest.Text.Length == 0) { MessageBox.Show("请输入转出目录"); } else { this.Cursor = Cursors.WaitCursor; foreach (object obj2 in this.listBox1.Items) { try { string path = obj2.ToString(); SaveFileDialog dialog = new SaveFileDialog(); string str2 = ".style"; if (this.m_IsStyleFile) { str2 = ".ServerStyle"; } string str3 = Path.Combine(this.txtDest.Text, Path.GetFileNameWithoutExtension(path) + str2); if (File.Exists(str3)) { File.Delete(str3); } dialog.FileName = str3; Stream stream = dialog.OpenFile(); if (stream != null) { Stream manifestResourceStream; int num; IStyleGallery gallery; IStyleGallery gallery2; int num3; string str4; if (!this.m_IsStyleFile) { manifestResourceStream = base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.style"); } else { manifestResourceStream = base.GetType() .Assembly.GetManifestResourceStream( "Yutai.ArcGIS.Controls.Controls.SymbolUI.template.ServerStyle"); } byte[] buffer = new byte[4096]; while ((num = manifestResourceStream.Read(buffer, 0, 4096)) > 0) { stream.Write(buffer, 0, num); } stream.Close(); if (this.m_IsStyleFile) { gallery = new MyStyleGallery(); gallery2 = new ServerStyleGalleryClass(); num3 = (gallery2 as IStyleGalleryStorage).FileCount - 1; while (num3 >= 0) { str4 = (gallery2 as IStyleGalleryStorage).get_File(num3); (gallery2 as IStyleGalleryStorage).RemoveFile(str4); num3--; } } else { gallery = new ServerStyleGalleryClass(); gallery2 = new MyStyleGallery(); num3 = (gallery as IStyleGalleryStorage).FileCount - 1; while (num3 >= 0) { str4 = (gallery as IStyleGalleryStorage).get_File(num3); (gallery as IStyleGalleryStorage).RemoveFile(str4); num3--; } } gallery.Clear(); gallery2.Clear(); (gallery as IStyleGalleryStorage).AddFile(path); (gallery2 as IStyleGalleryStorage).TargetFile = str3; for (num3 = 0; num3 < gallery.ClassCount; num3++) { string name = gallery.get_Class(num3).Name; IEnumBSTR mbstr = gallery.get_Categories(name); mbstr.Reset(); for (string str6 = mbstr.Next(); str6 != null; str6 = mbstr.Next()) { IEnumStyleGalleryItem item = gallery.get_Items(name, path, str6); item.Reset(); IStyleGalleryItem item2 = null; try { item2 = item.Next(); } catch { } while (item2 != null) { if (this.m_IsStyleFile) { IStyleGalleryItem item3 = new ServerStyleGalleryItemClass(); object obj3 = item2.Item; item3.Item = obj3; string str7 = item2.Name; item3.Name = str7; string category = item2.Category; item3.Category = category; gallery2.AddItem(item3); } else { gallery2.AddItem(item2); } try { item2 = item.Next(); } catch { } } } } (gallery as IStyleGalleryStorage).RemoveFile(path); (gallery2 as IStyleGalleryStorage).RemoveFile(str3); } } catch (Exception) { } } this.Cursor = Cursors.Default; base.Close(); } }
private void Form1_Load(object sender, System.EventArgs e) { //Resize the controls so that they scale correctly at both 96 and 120 dpi AdjustBounds(this.axToolbarControl1); AdjustBounds(this.axLicenseControl1); AdjustBounds(this.axPageLayoutControl1); AdjustBounds(this.axSymbologyControl1); //Set the buddy control axToolbarControl1.SetBuddyControl(axPageLayoutControl1); //Add items to the ToolbarControl axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsSelectTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewMarkerTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewLineTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewFreeHandTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewRectangleTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewPolygonTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Get the ArcGIS install location by opening the subkey for reading //Load the ESRI.ServerStyle file into the SymbologyControl string installationFolder = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; axSymbologyControl1.LoadStyleFile(installationFolder + "\\Styles\\ESRI.ServerStyle"); //Add style classes to the combo box ComboBox1.Items.Add("Default Marker Symbol"); ComboBox1.Items.Add("Default Line Symbol"); ComboBox1.Items.Add("Default Fill Symbol"); ComboBox1.Items.Add("Default Text Symbol"); ComboBox1.SelectedIndex = 0; //Update each style class. This forces item to be loaded into each style class. //When the contents of a server style file are loaded into the SymbologyControl //items are 'demand loaded'. This is done to increase performance and means //items are only loaded into a SymbologyStyleClass when it is the current StyleClass. axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols).Update(); //Get the CommandsEnvironment singleton m_graphicProperties = new CommandsEnvironmentClass(); //Create a new ServerStyleGalleryItem and set its name IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = "myStyle"; ISymbologyStyleClass styleClass; //Get the marker symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols); //Set the commands environment marker symbol into the item styleGalleryItem.Item = m_graphicProperties.MarkerSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the line symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols); //Set the commands environment line symbol into the item styleGalleryItem.Item = m_graphicProperties.LineSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the fill symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols); //Set the commands environment fill symbol into the item styleGalleryItem.Item = m_graphicProperties.FillSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the text symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols); //Set the commands environment text symbol into the item styleGalleryItem.Item = m_graphicProperties.TextSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); }
private void Form1_Load(object sender, System.EventArgs e) { //Resize the controls so that they scale correctly at both 96 and 120 dpi AdjustBounds(this.axToolbarControl1); AdjustBounds(this.axLicenseControl1); AdjustBounds(this.axPageLayoutControl1); AdjustBounds(this.axSymbologyControl1); //Set the buddy control axToolbarControl1.SetBuddyControl(axPageLayoutControl1); //Add items to the ToolbarControl axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsSelectTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewMarkerTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewLineTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewFreeHandTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewRectangleTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsNewPolygonTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Get the ArcGIS install location by opening the subkey for reading //Load the ESRI.ServerStyle file into the SymbologyControl string installationFolder = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; axSymbologyControl1.LoadStyleFile(installationFolder + "\\Styles\\ESRI.ServerStyle"); //Add style classes to the combo box ComboBox1.Items.Add("Default Marker Symbol"); ComboBox1.Items.Add("Default Line Symbol"); ComboBox1.Items.Add("Default Fill Symbol"); ComboBox1.Items.Add("Default Text Symbol"); ComboBox1.SelectedIndex = 0; //Update each style class. This forces item to be loaded into each style class. //When the contents of a server style file are loaded into the SymbologyControl //items are 'demand loaded'. This is done to increase performance and means //items are only loaded into a SymbologyStyleClass when it is the current StyleClass. axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols).Update(); axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols).Update(); //Get the CommandsEnvironment singleton m_graphicProperties = new CommandsEnvironmentClass(); //Create a new ServerStyleGalleryItem and set its name IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = "myStyle"; ISymbologyStyleClass styleClass; //Get the marker symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassMarkerSymbols); //Set the commands environment marker symbol into the item styleGalleryItem.Item = m_graphicProperties.MarkerSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the line symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassLineSymbols); //Set the commands environment line symbol into the item styleGalleryItem.Item = m_graphicProperties.LineSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the fill symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassFillSymbols); //Set the commands environment fill symbol into the item styleGalleryItem.Item = m_graphicProperties.FillSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); //Get the text symbol style class styleClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassTextSymbols); //Set the commands environment text symbol into the item styleGalleryItem.Item = m_graphicProperties.TextSymbol; //Add the item to the style class styleClass.AddItem(styleGalleryItem, 0); }
private void btnok_Click(object sender, EventArgs e) { ////构建图片存储临时目录 //FileInfo fileInfo = new FileInfo(fileName); //string path = fileInfo.DirectoryName; //string bitmapFileName = path + @"\" + this.txtSymbolName.Text + ".bmp"; ////创建新的画图,并将底色清为白色 ////Bitmap bitmap = new Bitmap(100, 100, PixelFormat.Format24bppRgb); //Bitmap bitmap = new Bitmap(listBoxImage.ImageSize.Width - 100, listBoxImage.ImageSize.Height); //Graphics graphics = Graphics.FromImage(bitmap); //System.Drawing.Color color = System.Drawing.Color.FromArgb(0, 0, 0); //graphics.Clear(Color.White); ////将各个子样式在画图上绘制 //Bitmap image; //int startX; //int startY; //for (int i = 0; i < supergrid.PrimaryGrid.Rows.Count; i++) //{ // image = (Bitmap)imagelist[i]; // startX = picturepre.Width / 2 - (int)(imagelist[i].Size.Width * Radio) / 2; // startY = picturepre.Height / 2 - (int)(imagelist[i].Size.Height * Radio) / 2; // image.MakeTransparent(Color.Transparent); // System.Drawing.Rectangle rectangle = new Rectangle(startX-50, startY-50, (int)(imagelist[i].Size.Width * Radio), (int)(imagelist[i].Size.Height * Radio)); // graphics.DrawImage(imagelist[i], rectangle); // graphics.Save(); //} //graphics.SmoothingMode = SmoothingMode.HighQuality; //graphics.Dispose(); ////将图片保存在临时目录 //bitmap.Save(bitmapFileName, System.Drawing.Imaging.ImageFormat.Bmp); ////创建图片样式 //IPictureMarkerSymbol pictureMarkerSymbol = new PictureMarkerSymbolClass(); //pictureMarkerSymbol.CreateMarkerSymbolFromFile(esriIPictureType.esriIPictureBitmap, bitmapFileName); //pictureMarkerSymbol.Angle = 0; //pictureMarkerSymbol.Size = 30; //pictureMarkerSymbol.XOffset = 0; //pictureMarkerSymbol.YOffset = 0; for (int i = 0; i < Symbollist.Count; i++) { pMultiLineSymbol.AddLayer(Symbollist[i] as IMarkerSymbol); } IStyleGallery styleGallery; IStyleGalleryItem styleGalleryItem; IStyleGalleryStorage styleGalleryStorge; //创建新的样式 styleGalleryItem = new ServerStyleGalleryItemClass(); styleGalleryItem.Name = this.txtSymbolName.Text; styleGalleryItem.Category = "default"; object objSymbol = pMultiLineSymbol; styleGalleryItem.Item = objSymbol; styleGallery = new ServerStyleGalleryClass(); styleGalleryStorge = styleGallery as IStyleGalleryStorage; styleGalleryStorge.TargetFile = fileName; //添加新样式 //styleGallery.AddItem(styleGalleryItem); ISymbologyStyleClass pSymbolClass = psymbologyStyleClass; pSymbolClass.AddItem(styleGalleryItem, 0); pSymbolClass.SelectItem(0); //保存新样式 //styleGallery.SaveStyle(fileName, fileInfo.Name, "marker Symbols"); this.Close(); }