Esempio n. 1
0
        private void SetFeatureClassStyle(esriSymbologyStyleClass symbologyStyleClass)
        {
            this.axSymbologyControl.StyleClass = symbologyStyleClass;
            ISymbologyStyleClass pSymbologyStyleClass = this.axSymbologyControl.GetStyleClass(symbologyStyleClass);

            pSymbologyStyleClass.SelectItem(0);
        }
Esempio n. 2
0
        //添加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);
        }
Esempio n. 3
0
        /// <summary>
        /// 初始化SymbologyControl的StyleClass,图层如果已有符号,则把符号添加到SymbologyControl中的第一个符号,并选中
        /// </summary>
        /// <param name="symbologyStyleClass"></param>
        private void SetFeatureClassStyle(esriSymbologyStyleClass symbologyStyleClass)
        {
            axSymbologyCtlFrame.StyleClass = symbologyStyleClass;
            ISymbologyStyleClass pSymbologyStyleClass = axSymbologyCtlFrame.GetStyleClass(symbologyStyleClass);

            pSymbologyStyleClass.SelectItem(0);
        }
Esempio n. 4
0
        private void InitialColorRamp(esriSymbologyStyleClass styleClass)
        {
            if (m_pRasterRenderer is IRasterStretchColorRampRenderer)
            {
                //得到当前栅格拉伸渲染样式
                IRasterStretchColorRampRenderer rasterStrecthcRenderer = m_pRasterRenderer as IRasterStretchColorRampRenderer;

                //从文件打开渲染库
                string sInstall = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";
                axSymbologyControl1.LoadStyleFile(sInstall);
                axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps;
                pSymbolClass = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps);

                IStyleGalleryItem pStyleGalleryItem = new ServerStyleGalleryItem();
                pStyleGalleryItem.Item = rasterStrecthcRenderer.ColorRamp;
                pSymbolClass.AddItem(pStyleGalleryItem, 0);

                //将渲染库中所有渲染方式添加到列表中
                for (int i = 0; i < pSymbolClass.ItemCount; i++)
                {
                    stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(pSymbolClass.GetItem(i), cmbColorRamp.Width, cmbColorRamp.Height);
                    Image image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle));
                    cmbColorRamp.Items.Add(image);
                }
                if (pSymbolClass.ItemCount > 0)
                {
                    pSymbolClass.SelectItem(0);
                }
                if (cmbColorRamp.Items.Count > 0)
                {
                    cmbColorRamp.SelectedIndex = 0;
                }
            }
        }
Esempio n. 5
0
 private void FrmNorthArrow_Load(object sender, EventArgs e)
 {
     try
     {
         //加载指北针样式
         string EsriStylePath = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";
         axSymbologyControl.LoadStyleFile(EsriStylePath);
         axSymbologyControl.StyleClass = esriSymbologyStyleClass.esriStyleClassNorthArrows;
         ISymbologyStyleClass symbologyStyleClass = axSymbologyControl.GetStyleClass(axSymbologyControl.StyleClass);
         if (m_pNorthArrow != null)
         {
             m_pStyleGalleryItem      = new ServerStyleGalleryItem();
             m_pStyleGalleryItem.Item = m_pNorthArrow;
             symbologyStyleClass.AddItem(m_pStyleGalleryItem, 0);
         }
         symbologyStyleClass.SelectItem(0);
         ////选择第一个指北针样式为预定样式
         //SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassNorthArrows);
         ////默认设置
         //角度设置
         this.NorthArrowAngle.Value = 0;
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 从符号库ServerStyle选择符号
        /// </summary>
        /// <param name="styleClass">符号类型</param>
        /// <param name="pSymbol">输入的符号,可以是空</param>
        /// <returns></returns>
        public IStyleGalleryItem GetItem(esriSymbologyStyleClass styleClass, object pSymbol)
        {
            SetGroupVisible(5);
            m_pStyle = styleClass;
            axSymbologyControl1.StyleClass = m_pStyle;
            ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(styleClass);

            if (pSymbol != null)
            {
                try
                {
                    m_styleGalleryItem      = new ServerStyleGalleryItemClass();
                    m_styleGalleryItem.Item = pSymbol;
                    m_styleGalleryItem.Name = "tempSymbo";

                    PreviewImage(m_styleGalleryItem);
                    symbologyStyleClass.AddItem(m_styleGalleryItem, 0);
                    symbologyStyleClass.SelectItem(0);
                }
                catch
                {
                }
            }
            this.ShowDialog();

            return(m_styleGalleryItem);
        }
Esempio n. 7
0
 private void btnok_Click(object sender, EventArgs e)
 {
     if (pSymbolOK != null)
     {
         IStyleGalleryItem currentStyleGalleryItem = new ServerStyleGalleryItem();
         currentStyleGalleryItem.Item = pSymbolOK;
         psymbologyStyleClass.AddItem(currentStyleGalleryItem, 0);
         psymbologyStyleClass.SelectItem(0);
         this.Close();
     }
     else
     {
     }
 }
Esempio n. 8
0
        //选择样式前返回面图片
        public Image GetImageByGiveAreaSymbolBeforeSelectItem(esriSymbologyStyleClass styleClass, IAreaPatch symbol, int width, int height)
        {
            axSymbologyCtlFrame.StyleClass = styleClass;
            ISymbologyStyleClass symbologyStyleClass = axSymbologyCtlFrame.GetStyleClass(styleClass);

            IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItem();

            styleGalleryItem.Item = symbol;
            symbologyStyleClass.AddItem(styleGalleryItem, 0);
            symbologyStyleClass.SelectItem(0);
            stdole.IPictureDisp  picture = symbologyStyleClass.PreviewItem(pStyleGalleryItem, width, height);
            System.Drawing.Image image   = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle));
            return(image);
        }
Esempio n. 9
0
        /// <summary>
        /// ���ú�SymbologyControl��StyleClass,�����ͼ��,�ѵ�ǰ��TOCͼ���ķ�����ӵ���ǰSymbologyStyleClass��ȥ,����֮����ѡ��״̬
        /// </summary>
        /// <param name="symbologyStyleClass"></param>
        private void SetFeatureClassStyle(esriSymbologyStyleClass symbologyStyleClass)
        {
            this.axSymbologyControl.StyleClass = symbologyStyleClass;
            ISymbologyStyleClass pSymbologyStyleClass = this.axSymbologyControl.GetStyleClass(symbologyStyleClass);

            if (this.pLegendClass != null)
            {
                IStyleGalleryItem currentStyleGalleryItem = new ServerStyleGalleryItem();
                currentStyleGalleryItem.Name = "Current Symbol";
                currentStyleGalleryItem.Item = pLegendClass.Symbol;
                pSymbologyStyleClass.AddItem(currentStyleGalleryItem, 0);
                this.pStyleGalleryItem = currentStyleGalleryItem;
            }
            pSymbologyStyleClass.SelectItem(0);
        }
Esempio n. 10
0
        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="styleClass">The style class.</param>
        /// <param name="styleItem">The style item.</param>
        /// <returns>IStyleGalleryItem.</returns>
        public IStyleGalleryItem GetItem(esriSymbologyStyleClass styleClass, object styleItem)
        {
            this._styleGalleryItem = null;
            this.axSymbologyControl1.StyleClass = styleClass;
            ISymbologyStyleClass styleClass2 = this.axSymbologyControl1.GetStyleClass(styleClass);

            if (styleItem != null)
            {
                this._styleGalleryItem      = new ServerStyleGalleryItemClass();
                this._styleGalleryItem.Item = styleItem;
                this._styleGalleryItem.Name = frmSymbolSelector.MSG01;
                styleClass2.AddItem(this._styleGalleryItem, 0);
                styleClass2.SelectItem(0);
            }
            base.ShowDialog();
            return(this._styleGalleryItem);
        }
Esempio n. 11
0
        private void SetFeatureClassStyle(esriSymbologyStyleClass symbologyStyleClass)
        {
            this.axSymbologyControl1.StyleClass = symbologyStyleClass;
            ISymbologyStyleClass pSymbologyStyleClass = this.axSymbologyControl1.
                                                        GetStyleClass(symbologyStyleClass);

            if (this.pLegendClass  !=  null)   
            {
                 
                    IStyleGalleryItem currentStyleGalleryItem  =  new ServerStyleGalleryItem();       

                currentStyleGalleryItem.Name  =   "当前符号";  
                currentStyleGalleryItem.Item  =  pLegendClass.Symbol;      
                pSymbologyStyleClass.AddItem(currentStyleGalleryItem, 0);       
                this.pStyleGalleryItem  =  currentStyleGalleryItem;  
            }  
            pSymbologyStyleClass.SelectItem(0);
        }
Esempio n. 12
0
        //添加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);
        }
Esempio n. 13
0
        //构造器选择
        //int FrmIndex = 0;

        public FrmSymbol(string[] symbolstyle, ISymbol symbol, esriSymbologyStyleClass styleClass)
        {
            InitializeComponent();
            this.EnableGlass = false;
            SymbolStyle      = symbolstyle;
            pStyleClass      = styleClass;
            pSymbol          = symbol;

            //Add by Liuzhaoqin,2013.11.16
            axSymbologyControl.StyleClass = styleClass;
            ISymbologyStyleClass symbologyStyleClass = axSymbologyControl.GetStyleClass(styleClass);

            if (symbol != null)
            {
                pStyleGalleryItem      = new ServerStyleGalleryItem();
                pStyleGalleryItem.Item = symbol;
                pStyleGalleryItem.Name = "Current";

                symbologyStyleClass.AddItem(pStyleGalleryItem, 0);
                symbologyStyleClass.SelectItem(0);
            }
        }
        public IStyleGalleryItem GetItem(esriSymbologyStyleClass styleClass, ISymbol symbol)
        {
            m_styleGalleryItem = null;

            //Get and set the style class
            axSymbologyControl1.StyleClass = styleClass;
            ISymbologyStyleClass symbologyStyleClass = axSymbologyControl1.GetStyleClass(styleClass);

            //Create a new server style gallery item with its style set
            IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItem();

            styleGalleryItem.Item = symbol;
            styleGalleryItem.Name = "mySymbol";

            //Add the item to the style class and select it
            symbologyStyleClass.AddItem(styleGalleryItem, 0);
            symbologyStyleClass.SelectItem(0);

            //Show the modal form
            this.ShowDialog();

            return(m_styleGalleryItem);
        }
Esempio n. 15
0
        //选择样式前返回图片
        public Image GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass styleClass, ISymbol symbol, int width, int height)
        {
            try
            {
                axSymbologyControl.StyleClass = styleClass;
                ISymbologyStyleClass symbologyStyleClass = axSymbologyControl.GetStyleClass(styleClass);

                IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItem();

                styleGalleryItem.Item = symbol;
                //// styleGalleryItem.Name = "DefaultSymbol";
                symbologyStyleClass.AddItem(styleGalleryItem, 0);
                symbologyStyleClass.SelectItem(0);
                stdole.IPictureDisp  picture = symbologyStyleClass.PreviewItem(pStyleGalleryItem, width, height);
                System.Drawing.Image image   = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle));
                return(image);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                return(null);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 初始化与拉伸相关控件
        /// </summary>
        private void initstreach()
        {
            string sInstall = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";

            axSymbologyControl1.LoadStyleFile(sInstall);
            axSymbologyControl1.StyleClass = esriSymbologyStyleClass.esriStyleClassColorRamps;
            pSymbolClass           = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps);
            pRasterRender          = pRLayer.Renderer;
            pRasterRenderColorRamp = pRasterRender as IRasterRendererColorRamp;
            //生成色度带
            if (pRasterRender is IRasterStretchColorRampRenderer)
            {
                IStyleGalleryItem pStyleGalleryItem = new ServerStyleGalleryItem();
                pStyleGalleryItem.Item = pRasterRenderColorRamp.ColorRamp;
                pSymbolClass.AddItem(pStyleGalleryItem, 0);
                pSymbolClass.SelectItem(0);
            }
            for (int i = 0; i < pSymbolClass.get_ItemCount(pSymbolClass.StyleCategory); i++)
            {
                stdole.IPictureDisp pPicture = pSymbolClass.PreviewItem(pSymbolClass.GetItem(i), cmbColorRamp.Width, cmbColorRamp.Height);
                Image image = Image.FromHbitmap(new System.IntPtr(pPicture.Handle));
                cmbColorRamp.Items.Add(image);
            }

            if (cmbColorRamp.Items.Count > 0)
            {
                cmbColorRamp.SelectedIndex = 0;
            }
            //判断拉伸方式和拉伸波段
            if (pRasterRender is IRasterStretchColorRampRenderer)
            {
                pSCRampRender  = pRasterRender as IRasterStretchColorRampRenderer;
                pRasterStretch = pRasterRender as IRasterStretch;
                int bandindex = pSCRampRender.BandIndex;
                cmbBand.SelectedIndex = bandindex;
                if (pRasterStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_Custom)
                {
                    cmbStreach.SelectedIndex = 1;
                }
                else if (pRasterStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_MinimumMaximum)
                {
                    cmbStreach.SelectedIndex = 2;
                }
                else if (pRasterStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_StandardDeviations)
                {
                    cmbStreach.SelectedIndex = 3;
                }
                else if (pRasterStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_HistogramEqualize)
                {
                    cmbStreach.SelectedIndex = 4;
                }
                else
                {
                    cmbStreach.SelectedIndex = 0;
                }

                lblminstr.Text = pSCRampRender.LabelLow;
                lblmaxstr.Text = pSCRampRender.LabelHigh;
                txtmin.Text    = pSCRampRender.LabelLow;
                txtmax.Text    = pSCRampRender.LabelHigh;
                if (pRasterStretch.StretchType == esriRasterStretchTypesEnum.esriRasterStretch_MinimumMaximum)
                {
                    txtmax.Visible = true;
                    txtmin.Visible = false;
                }
            }
            else
            {
                cmbBand.SelectedIndex    = 0;
                cmbStreach.SelectedIndex = 0;
            }
            isminmax = true;
        }
        //.................................................
        //.................................................
        //.................................................
        private void LineSectionLayerSettings_Load(object sender, EventArgs e)
        {
            if (_layerDef != null)
            {
                lblLayerName.Text = _layerDef.layername;
                lblLayerDesc.Text = _layerDef.Description;
            }

            // Load the Color Ramps

            _styleFilePath = Path.ChangeExtension(Application.ExecutablePath, ".serverStyle");

            if (File.Exists(_styleFilePath))
            {
                //Load the ESRI.ServerStyle file into the SymbologyControl
                axSymbologyControl1.LoadStyleFile(_styleFilePath);
                //Set the style class
                axSymbologyControl1.StyleClass = ESRI.ArcGIS.Controls.esriSymbologyStyleClass.esriStyleClassColorRamps;
                //Select the color ramp item
                axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass).SelectItem(0);
                _styleFileFound = true;
            }
            else
            {
                if (rbColorRamp.Checked)
                {
                    rbByLayer.Checked = true;
                }
                rbColorRamp.Enabled   = false;
                _styleFileFound       = false;
                lblColorRampName.Text = "Color Ramp Style File not Found!";
            }


            //Get the Layer Info needed
            IGeoFeatureLayer geofeaturelayer = null;
            IMap             map             = _GISdata._activeview.FocusMap;

            for (int i = 0; i <= map.LayerCount - 1; i++)
            {
                if (map.get_Layer(i).Name == _layerDef.layername)
                {
                    geofeaturelayer = (IGeoFeatureLayer)map.get_Layer(i);
                    break;
                }
            }
            if (geofeaturelayer == null)
            {
                return;
            }
            m_featureLayer = geofeaturelayer;

            // Initialize Default Display Renderer
            m_SimpleRenderer = new SimpleRendererClass();
            AssignDefaultRenderer();

            // See what current settings are and set them on the form
            _displaymode           = _GISdata._cwdata.Configuration.BPLSDisplayMode;
            _selectedcolorrampname = _GISdata._cwdata.Configuration.BPSavedColorRampName;
            if (_styleFileFound)
            {
                lblColorRampName.Text = _selectedcolorrampname;
            }
            switch (_displaymode)
            {
            case (1):
                rbByLayer.Checked = true;
                break;

            case (2):
                rbByRiskLevel.Checked = true;
                break;

            case (3):
                rbColorRamp.Checked = true;
                break;
            }
            cbRiskRankingChoices.SelectedIndex = _GISdata._cwdata.Configuration.BPRiskFieldtoUse;
            if ((_selectedcolorrampname.Length > 0) && (_styleFileFound))
            {
                ISymbologyStyleClass SC = axSymbologyControl1.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps);
                int i;
                for (i = 0; i <= SC.ItemCount - 1; i++)
                {
                    if (SC.GetItem(i).Name == _selectedcolorrampname)
                    {
                        SC.SelectItem(i);
                        break;
                    }
                }

                //IStyleGalleryItem serverStyleGalleryItem = axSymbologyControl1.GetStyleClass (axSymbologyControl1.StyleClass).GetSelectedItem();
                //System.Windows.Forms.MessageBox.Show(serverStyleGalleryItem.Name);
            }

            // Get Statistics to display
            LoadStatistics();
            // Done
            _displayModified = false;
            SetControls();
        }
Esempio n. 18
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();
        }
        private void SymbologyForm_Load(object sender, EventArgs e)
        {
            switch (((IFeatureLayer)pLayer).FeatureClass.ShapeType)
                                                            //判断图层中要素类的图形类型,不同类型显示的调节值的控件不同
                {
                case esriGeometryType.esriGeometryPoint:    //点
                        pStyleClass = esriSymbologyStyleClass.esriStyleClassMarkerSymbols;
                    lbColor.Visible  = true;
                    lbWidth.Visible  = true;
                    lbWidth.Text     = "符号大小";
                    lbAngle.Visible  = true;
                    btColor.Visible  = true;
                    nudWidth.Visible = true;
                    cbColor.Visible  = true;
                    nudAngle.Visible = true;
                    break;

                case esriGeometryType.esriGeometryPolyline:   //线
                        pStyleClass = esriSymbologyStyleClass.esriStyleClassLineSymbols;
                    lbColor.Visible   = true;
                    lbColor.Location  = System.Drawing.Point.Add(lbColor.Location, new Size(0, 12));
                    lbWidth.Visible   = true;
                    lbWidth.Location  = System.Drawing.Point.Add(lbWidth.Location, new Size(0, 24));
                    lbWidth.Text      = "线符号粗细";
                    btColor.Visible   = true;
                    cbColor.Visible   = true;
                    btColor.Location  = System.Drawing.Point.Add(btColor.Location, new Size(0, 12));
                    cbColor.Location  = System.Drawing.Point.Add(cbColor.Location, new Size(0, 12));
                    nudWidth.Visible  = true;
                    nudWidth.Location = System.Drawing.Point.Add(nudWidth.Location, new Size(0, 24));
                    break;

                case esriGeometryType.esriGeometryPolygon:   //面
                        pStyleClass = esriSymbologyStyleClass.esriStyleClassFillSymbols;
                    lbColor.Visible        = true;
                    lbWidth.Visible        = true;
                    lbWidth.Text           = "框线宽度";
                    lbOutlineColor.Visible = true;
                    btColor.Visible        = true;
                    btOutlineColor.Visible = true;
                    nudWidth.Visible       = true;
                    cbColor.Visible        = true;
                    cbOutlineColor.Visible = true;
                    break;

                default:
                    this.Close();
                    break;
                }
            //ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path 可以获得 ArcGIS 的安装目录
            //获取 ESRI.ServerStyle 文件并加载入axSymbologyControl控件
            string stylePath = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path + @"Styles\ESRI.ServerStyle";

            axSymbologyControl1.LoadStyleFile(stylePath);
            axSymbologyControl1.StyleClass = pStyleClass;   //将上面获得的 pStyleClass 赋给axSymbologyControl控件,点线面
            //新建符号实例,用当前图例的符号类型 赋值,并将其添加到axSymbologyControl中
            IStyleGalleryItem pCurrentStyleGalleryItem = new StyleGalleryItem();

            pCurrentStyleGalleryItem.Name = "当前符号";
            pCurrentStyleGalleryItem.Item = pLegendClass.Symbol;   
            ISymbologyStyleClass pSymbologyStyleClass = axSymbologyControl1.GetStyleClass(axSymbologyControl1.StyleClass);   //QI,加入这个新建项

            pSymbologyStyleClass.AddItem(pCurrentStyleGalleryItem, 0);

            pSymbologyStyleClass.SelectItem(0);     //设置为选中状态
        }