コード例 #1
0
 /// <summary>
 /// 初始化封装AxSymbologyControl的常用操作的符号选择器,向AxSymbologyControl加载指定图例
 /// </summary>
 /// <param name="symbologyControl"></param>
 /// <param name="layer">要设置样式的图层</param>
 /// <param name="legendClass">当前所选的图层图例(包含符号(Symbol)及其标注与描述等)</param>
 public SymbolSelector(AxSymbologyControl symbologyControl, ILayer layer, ILegendClass legendClass)
 {
     SymbologyControl = symbologyControl;
     LegendClass      = legendClass;
     Layer            = layer;
     LoadStyle();
 }
コード例 #2
0
ファイル: SymbolFunction.cs プロジェクト: Mengzuozhu/AeHelper
        /// <summary>
        /// 在图片框中预览符号样式
        /// </summary>
        /// <param name="symbologyCtrl">符号控件</param>
        /// <param name="styleGalleryItem">符号样式</param>
        /// <param name="pictureBox">图片框</param>
        public static void PreviewImage(AxSymbologyControl symbologyCtrl, IStyleGalleryItem styleGalleryItem,
                                        PictureBox pictureBox)
        {
            //获取符号样式类
            ISymbologyStyleClass symbologyStyleClass = symbologyCtrl.GetStyleClass(symbologyCtrl.StyleClass);

            //获取符号图片
            stdole.IPictureDisp picture = symbologyStyleClass.PreviewItem(styleGalleryItem, pictureBox.Width,
                                                                          pictureBox.Height);
            Image image = Image.FromHbitmap(new IntPtr(picture.Handle));

            pictureBox.Image = image;
        }
コード例 #3
0
ファイル: SymbolFunction.cs プロジェクト: Mengzuozhu/AeHelper
        /// <summary>
        /// 加载系统符号样式
        /// </summary>
        /// <param name="symbologyCtrl">符号显示控件</param>
        /// <param name="symbologyStyle">符号样式</param>
        /// <param name="subFolder"></param>
        public static void LoadSymbolStyle(AxSymbologyControl symbologyCtrl, esriSymbologyStyleClass symbologyStyle,
                                           string subFolder = @"Symbol\StyleSymbol\ESRI.ServerStyle")
        {
            symbologyCtrl.Clear();
            string styleFilePath = string.Format(@"{0}\{1}", Application.StartupPath, subFolder);

            //载入系统符号库
            symbologyCtrl.LoadStyleFile(styleFilePath);
            symbologyCtrl.StyleClass = symbologyStyle;
            ISymbologyStyleClass pSymStyleClass = symbologyCtrl.GetStyleClass(symbologyCtrl.StyleClass);

            pSymStyleClass.GetItem(0);
            pSymStyleClass.UnselectItem();
        }
コード例 #4
0
ファイル: SymbologyWindow.xaml.cs プロジェクト: cdbean/CAGA
 public void Initialize()
 {
     // Create an object of the symbology control.
     
     System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
     // Create an object of the map control.
     this._axSymCtrl = new AxSymbologyControl();
     this._axSymCtrl.BeginInit();
     
     host.Child = this._axSymCtrl;
     this.SymbolCtrlGrid.Children.Add(host);
     this._axSymCtrl.OnItemSelected += new ESRI.ArcGIS.Controls.ISymbologyControlEvents_Ax_OnItemSelectedEventHandler(this.axSymCtrl_OnItemSelected);
     this._axSymCtrl.EndInit();
     this.LoadStyleFile();
 }
コード例 #5
0
ファイル: SymbologyWindow.xaml.cs プロジェクト: Rosyyou/CAGA
        public void Initialize()
        {
            // Create an object of the symbology control.

            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
            // Create an object of the map control.
            this._axSymCtrl = new AxSymbologyControl();
            this._axSymCtrl.BeginInit();

            host.Child = this._axSymCtrl;
            this.SymbolCtrlGrid.Children.Add(host);
            this._axSymCtrl.OnItemSelected += new ESRI.ArcGIS.Controls.ISymbologyControlEvents_Ax_OnItemSelectedEventHandler(this.axSymCtrl_OnItemSelected);
            this._axSymCtrl.EndInit();
            this.LoadStyleFile();
        }
コード例 #6
0
ファイル: MapAPI.cs プロジェクト: rs-sdust/GFStatistics
 /// <summary>
 /// Add the style file.
 /// </summary>
 /// <param name="axSymbologyControl1">The ax symbology control1.</param>
 /// <param name="sDestPath">The s dest path.</param>
 public static void AddStyleFile(AxSymbologyControl axSymbologyControl1, string sDestPath)
 {
     System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
     openFileDialog.CheckPathExists  = true;
     openFileDialog.CheckFileExists  = true;
     openFileDialog.RestoreDirectory = true;
     openFileDialog.Multiselect      = false;
     openFileDialog.Filter           = "(style)|*.SeverStyle";
     if (openFileDialog.ShowDialog(EnviVars.instance.MainForm) == System.Windows.Forms.DialogResult.OK)
     {
         string fileName = System.IO.Path.GetFileName(openFileDialog.FileName);
         string text     = System.IO.Path.Combine(sDestPath, fileName);
         axSymbologyControl1.Clear();
         if (File.Exists(text))
         {
             string   fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName);
             string   extension = System.IO.Path.GetExtension(openFileDialog.FileName);
             string[] files     = Directory.GetFiles(sDestPath, fileNameWithoutExtension + "." + extension);
             int      num       = 1;
             string[] array     = files;
             for (int i = 0; i < array.Length; i++)
             {
                 string path = array[i];
                 string fileNameWithoutExtension2 = System.IO.Path.GetFileNameWithoutExtension(path);
                 int    num2  = 0;
                 string text2 = fileNameWithoutExtension2.Substring(fileNameWithoutExtension.Length);
                 if (!string.IsNullOrEmpty(text2) && int.TryParse(text2, out num2) && num2 > num)
                 {
                     num = num2 + 1;
                 }
             }
             text = System.IO.Path.Combine(sDestPath, fileNameWithoutExtension + num + extension);
         }
         File.Copy(openFileDialog.FileName, text, true);
         axSymbologyControl1.LoadStyleFile(openFileDialog.FileName);
         axSymbologyControl1.Refresh();
     }
 }
コード例 #7
0
        private void SymbolSelectorPropPage_Shown(object sender, EventArgs e)
        {
            m_axSymbologyControl = new AxSymbologyControl();
              m_axSymbologyControl.Parent = this;
              m_axSymbologyControl.SetBounds(16, 38, 298, 369);
              m_axSymbologyControl.Refresh();
              m_axSymbologyControl.Update();
              m_axSymbologyControl.OnItemSelected += new ISymbologyControlEvents_Ax_OnItemSelectedEventHandler(OnItemSelected);

              LoadStyle();
        }
コード例 #8
0
        protected override void OnPageDeactivate()
        {
            base.OnPageDeactivate();

              //unwire the OnItemSelected event
              m_axSymbologyControl.OnItemSelected -= new ISymbologyControlEvents_Ax_OnItemSelectedEventHandler(OnItemSelected);

              //dispose the control
              m_axSymbologyControl.Dispose();
              m_axSymbologyControl = null;
        }