//关闭按钮
 private void SymbologyForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!change)
     {
         IStyleGalleryItem pCurrentStyleGalleryItem = new StyleGalleryItem();
         pCurrentStyleGalleryItem.Name = "当前符号";
         pCurrentStyleGalleryItem.Item = pLegendClass.Symbol;
         pStyleGalleryItem             = pCurrentStyleGalleryItem;
     }
 }
 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";
     if (!File.Exists(stylePath)) return;
     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);     //设置为选中状态
 }
 //关闭按钮
 private void SymbologyForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!change)
     {
         IStyleGalleryItem pCurrentStyleGalleryItem = new StyleGalleryItem();
         pCurrentStyleGalleryItem.Name = "当前符号";
         pCurrentStyleGalleryItem.Item = pLegendClass.Symbol;
         pStyleGalleryItem = pCurrentStyleGalleryItem;
     }
 }
        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);     //设置为选中状态
        }