public void Style(string name, List <ComboBoxSym> cmblist) { IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleStorage; IEnumStyleGalleryItem enumStyleGalleryItem; IStyleGalleryItem styleItem; pStyleStorage = pStyleGallery as IStyleGalleryStorage; //默认地址,也可以自己定义 string stylePath = Application.StartupPath + "\\ESRI.ServerStyle"; pStyleStorage.AddFile(stylePath); switch (name) { case "Color Ramps": IStyleGalleryClass pStyleGalleryClass = new ColorRampStyleGalleryClassClass(); enumStyleGalleryItem = pStyleGallery.get_Items("Color Ramps", "ESRI.ServerStyle", ""); enumStyleGalleryItem.Reset(); styleItem = enumStyleGalleryItem.Next(); for (int i = 1; i < 55; i++) //while(styleItem!=null) { pListRamp.Add((IColorRamp)styleItem.Item); Bitmap bitmap = PreviewSymbol(pStyleGalleryClass, styleItem.Item, cmblist[0].Width, cmblist[0].Height); cmblist[0].Items.Add(bitmap); cmblist[1].Items.Add(bitmap); styleItem = enumStyleGalleryItem.Next(); } break; case "Colors": IStyleGalleryClass pStyleGalleryClass1 = new ColorStyleGalleryClassClass(); enumStyleGalleryItem = pStyleGallery.get_Items("Colors", "ESRI.ServerStyle", ""); enumStyleGalleryItem.Reset(); styleItem = enumStyleGalleryItem.Next(); for (int i = 1; i < 55; i++) //while (styleItem != null) { pListColor.Add((IColor)styleItem.Item); Bitmap bitmap = PreviewSymbol(pStyleGalleryClass1, styleItem.Item, cmblist[0].Width, cmblist[0].Height); cmblist[0].Items.Add(bitmap); cmblist[1].Items.Add(bitmap); styleItem = enumStyleGalleryItem.Next(); } break; } pStyleStorage.RemoveFile(stylePath); }
public void Style(string name, List<ComboBoxSym> cmblist) { IStyleGallery pStyleGallery; IStyleGalleryStorage pStyleStorage; IEnumStyleGalleryItem enumStyleGalleryItem; IStyleGalleryItem styleItem; pStyleGallery = new ServerStyleGalleryClass(); pStyleStorage = pStyleGallery as IStyleGalleryStorage; //默认地址,也可以自己定义 string stylePath = Application.StartupPath + "\\ESRI.ServerStyle"; pStyleStorage.AddFile(stylePath); switch (name) { case "Color Ramps": IStyleGalleryClass pStyleGalleryClass = new ColorRampStyleGalleryClassClass(); enumStyleGalleryItem = pStyleGallery.get_Items("Color Ramps", "ESRI.ServerStyle", ""); enumStyleGalleryItem.Reset(); styleItem = enumStyleGalleryItem.Next(); for (int i = 1; i <55; i++) //while(styleItem!=null) { pListRamp.Add((IColorRamp)styleItem.Item); Bitmap bitmap = PreviewSymbol(pStyleGalleryClass, styleItem.Item, cmblist[0].Width, cmblist[0].Height); cmblist[0].Items.Add(bitmap); cmblist[1].Items.Add(bitmap); styleItem = enumStyleGalleryItem.Next(); } break; case "Colors": IStyleGalleryClass pStyleGalleryClass1 = new ColorStyleGalleryClassClass(); enumStyleGalleryItem = pStyleGallery.get_Items("Colors", "ESRI.ServerStyle", ""); enumStyleGalleryItem.Reset(); styleItem = enumStyleGalleryItem.Next(); for (int i = 1; i < 55; i++) //while (styleItem != null) { pListColor.Add((IColor)styleItem.Item); Bitmap bitmap = PreviewSymbol(pStyleGalleryClass1, styleItem.Item, cmblist[0].Width, cmblist[0].Height); cmblist[0].Items.Add(bitmap); cmblist[1].Items.Add(bitmap); styleItem = enumStyleGalleryItem.Next(); } break; } pStyleStorage.RemoveFile(stylePath); }
private void DrawColorRamp() { string sInstall = ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path; string styleFilePath = sInstall + "\\Styles\\ESRI.ServerStyle"; IStyleGallery styleGallery = new ServerStyleGalleryClass(); IStyleGalleryItem styleGalleryItem = null; IStyleGalleryStorage styleGalleryStorage = styleGallery as IStyleGalleryStorage; styleGalleryStorage.AddFile(styleFilePath); IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Color Ramps", styleFilePath, ""); enumStyleGalleryItem.Reset(); styleGalleryItem = enumStyleGalleryItem.Next(); while (styleGalleryItem != null) { m_ColorRamp = (IColorRamp)styleGalleryItem.Item; EnumStyleItem.Add(m_ColorRamp); m_FillSymbol = new GradientFillSymbol(); m_FillSymbol.GradientAngle = 0; m_FillSymbol.ColorRamp = m_ColorRamp; pictureBox1.Image = SymbolToBitmap(m_FillSymbol, 0, pictureBox1.Width, pictureBox1.Height); imageList1.Images.Add(pictureBox1.Image); comboBoxColor.Items.Add(pictureBox1.Image); styleGalleryItem = enumStyleGalleryItem.Next(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(enumStyleGalleryItem); }
//added by chulili //函数功能:获取符号库中的符号 //输入参数:符号库全路径 符号类别 符号名 //输出参数:符号 //代码来源:借鉴同事代码 private static ISymbol GetSymbol(string stylefileFullname, string styleClassName, string sSymbolName) { ISymbol pSymbol = null; IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage; IEnumStyleGalleryItem pEnumStyleGalleryItem = new EnumServerStyleGalleryItemClass(); pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; pStyleGalleryStorage.AddFile(stylefileFullname); pEnumStyleGalleryItem = pStyleGallery.get_Items(styleClassName, stylefileFullname, ""); pEnumStyleGalleryItem.Reset(); IStyleGalleryItem pEnumItem; pEnumItem = pEnumStyleGalleryItem.Next(); while (pEnumItem != null) { if (pEnumItem.Name == sSymbolName) { pSymbol = pEnumItem.Item as ISymbol; break; } pEnumItem = pEnumStyleGalleryItem.Next(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleGalleryItem); return(pSymbol); }
// 从符号 public static ISymbol FetchSymbol(string name) { string strStartPath = System.Windows.Forms.Application.StartupPath; IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; pStyleGalleryStorage.AddFile(strStartPath + "\\mlb.ServerStyle"); IEnumStyleGalleryItem pEnumStyleGalleryItem = pStyleGallery.get_Items("Marker Symbols", strStartPath + "\\mlb.ServerStyle", null); ISymbol pSymbol = null; pEnumStyleGalleryItem.Reset(); IStyleGalleryItem pStyleGalleryItem = pEnumStyleGalleryItem.Next(); while (pStyleGalleryItem != null) { if (pStyleGalleryItem.Name == name) { //获取符号 pSymbol = pStyleGalleryItem.Item as ISymbol; System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleGalleryItem); break; } pStyleGalleryItem = pEnumStyleGalleryItem.Next(); } return(pSymbol); }
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(); } }
///<summary> ///获取符号库中符号 ///</summary> ///<param name="sServerStylePath">符号库全路径名称</param> ///<param name="sGalleryClassName">GalleryClass名称</param> ///<param name="symbolName">符号名称</param> ///<returns>符号</returns> private ISymbol GetSymbol(string sServerStylePath, string sGalleryClassName, string symbolName) { try { //ServerStyleGallery对象 IStyleGallery pStyleGaller = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage = pStyleGaller as IStyleGalleryStorage; IEnumStyleGalleryItem pEnumSyleGalleryItem = null; IStyleGalleryItem pStyleGallerItem = null; IStyleGalleryClass pStyleGalleryClass = null; //使用IStyleGalleryStorage接口的AddFile方法加载ServerStyle文件 pStyleGalleryStorage.AddFile(sServerStylePath); //遍历ServerGallery中的Class for (int i = 0; i < pStyleGaller.ClassCount; i++) { pStyleGalleryClass = pStyleGaller.get_Class(i); if (pStyleGalleryClass.Name != sGalleryClassName) { continue; } //获取EnumStyleGalleryItem对象 pEnumSyleGalleryItem = pStyleGaller.get_Items(sGalleryClassName, sServerStylePath, ""); pEnumSyleGalleryItem.Reset(); //遍历pEnumSyleGalleryItem pStyleGallerItem = pEnumSyleGalleryItem.Next(); while (pStyleGallerItem != null) { if (pStyleGallerItem.Name == symbolName) { //获取符号 ISymbol pSymbol = pStyleGallerItem.Item as ISymbol; System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem); System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass); return(pSymbol); } pStyleGallerItem = pEnumSyleGalleryItem.Next(); } } System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem); System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass); return(null); } catch (Exception Err) { MessageBox.Show(Err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return(null); } }
private void demo2(string CurrentStyleFile, string CurrentStyleGalleryClass) { IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage; pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; //增加符号文件 pStyleGalleryStorage.AddFile(CurrentStyleFile); //根据当前符号的类别和文件得到符号的枚举循环 //符号类别包括Fill Symbol,Line Symbol等 IEnumStyleGalleryItem mEnumStyleItem; mEnumStyleItem = pStyleGallery.get_Items(CurrentStyleGalleryClass, CurrentStyleFile, ""); //得到符号文件类别的各个条目,增加到一个Combox中 IEnumBSTR pEnumBSTR = pStyleGallery.get_Categories(CurrentStyleGalleryClass); pEnumBSTR.Reset(); string Category = ""; Category = pEnumBSTR.Next(); while (Category != null) { //cbxCategory.Items.Add(Category); Category = pEnumBSTR.Next(); } //得到各个符号并转化为图片 mEnumStyleItem.Reset(); IStyleGalleryItem mStyleItem = mEnumStyleItem.Next(); int ImageIndex = 0; IStyleGalleryClass mStyleClass = new FillSymbolStyleGalleryClassClass(); while (mStyleItem != null) { //调用另一个类的方法将符号转化为图片 Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem); Bitmap bmpS = StyleGalleryItemToBmp(16, 16, mStyleClass, mStyleItem); Largeimage.Images.Add(bmpB); Smallimage.Images.Add(bmpS); ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex); this.lvRendererFields.Items.Add(lvItem); mStyleItem = mEnumStyleItem.Next(); ImageIndex++; } //必须采用此方式进行释放,第二次才能正常读取 System.Runtime.InteropServices.Marshal.ReleaseComObject(mEnumStyleItem); }
/// <summary> /// 获取指定种类,指定符号id的符号 /// </summary> /// <param name="sGallery">符号种类(e.g.填充颜色)</param> /// <param name="id">符号id</param> /// <returns>符号</returns> public static ISymbol GetStyleSymbol(string sGallery, int id) { try { IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; for (int i = pStyleGalleryStorage.FileCount - 1; i >= 0; i--) { pStyleGalleryStorage.RemoveFile(pStyleGalleryStorage.get_File(i)); } pStyleGalleryStorage.AddFile(_STYLEFILE); IEnumStyleGalleryItem pEnumStyleItem = pStyleGallery.get_Items(sGallery, _STYLEFILE, ""); pEnumStyleItem.Reset(); IStyleGalleryItem mStyleItem = pEnumStyleItem.Next(); IStyleGalleryClass mStyleClass = null; for (int i = 0; i < pStyleGallery.ClassCount; i++) { mStyleClass = pStyleGallery.get_Class(i); string str = mStyleClass.Name; if (str == sGallery) { break; } } ISymbol result = null; while (mStyleItem != null) { if (mStyleItem.ID == id) { result = mStyleItem.Item as ISymbol; break; } mStyleItem = pEnumStyleItem.Next(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleItem); return(result); } catch { return(null); } }
/// <summary> /// 读取ServerStyle中的文件并显示 /// </summary> /// <param name="StyleGalleryClass">符号文件的种类</param> /// <param name="CategoryClass">符号的种类</param> /// <param name="cbxCategory">符号文件的种类的容器</param> /// <param name="lvSymbol">符号位图的容器</param> public static void ReadServerStyle(string StyleGalleryClass, string CategoryClass, ComboBox cbxCategory, ListView lvSymbol) { lvSymbol.Items.Clear(); lvSymbol.LargeImageList.Images.Clear(); IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; // 增加符号文件 //pStyleGalleryStorage.TargetFile = _STYLEFILE; for (int i = pStyleGalleryStorage.FileCount - 1; i >= 0; i--) { pStyleGalleryStorage.RemoveFile(pStyleGalleryStorage.get_File(i)); } pStyleGalleryStorage.AddFile(_STYLEFILE); // 根据当前符号的类别和文件得到符号的枚举循环子,符号类别包括Fill Symbol,Line Symbol等 IEnumStyleGalleryItem pEnumStyleItem = pStyleGallery.get_Items(StyleGalleryClass, _STYLEFILE, ""); // 得到符号文件类别的各个条目,增加到一个Combox中 if (cbxCategory != null) { cbxCategory.Items.Clear(); cbxCategory.Items.Add(_ALLSYMBOLS); IEnumBSTR pEnumBSTR = pStyleGallery.get_Categories(StyleGalleryClass); pEnumBSTR.Reset(); string Category = ""; Category = pEnumBSTR.Next(); while (Category != null) { cbxCategory.Items.Add(Category); Category = pEnumBSTR.Next(); } } pEnumStyleItem.Reset(); IStyleGalleryItem mStyleItem = pEnumStyleItem.Next(); IStyleGalleryClass mStyleClass = null; for (int i = 0; i < pStyleGallery.ClassCount; i++) { mStyleClass = pStyleGallery.get_Class(i); string str = mStyleClass.Name; if (str == StyleGalleryClass) { break; } } // 得到各个符号并转化为图片 int ImageIndex = 0; ImageList Largeimage = lvSymbol.LargeImageList; if (CategoryClass == "" || CategoryClass == _ALLSYMBOLS) { while (mStyleItem != null) { // 调用另一个类的方法将符号转化为图片 Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem); Largeimage.Images.Add(bmpB); ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex); lvSymbol.Items.Add(lvItem); ImageIndex++; mStyleItem = pEnumStyleItem.Next(); } } else { while (mStyleItem != null) { if (CategoryClass == mStyleItem.Category) { // 调用另一个类的方法将符号转化为图片 Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem); Largeimage.Images.Add(bmpB); ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex); lvSymbol.Items.Add(lvItem); ImageIndex++; } mStyleItem = pEnumStyleItem.Next(); } } // 必须采用此方式进行释放,第二次才能正常读取 System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumStyleItem); }
public static IMarkerSymbol FindMarkerSym(string stylename, string stylecategory, string symname) { //����Symbol��ʵ�֣�StyleGallery����Desktop IStyleGallery pStyGall; IStyleGalleryStorage pStyGallStor; IStyleGalleryItem pStyGallItem; IMarkerSymbol pMrkSym=null; IEnumStyleGalleryItem pEnumStyGallItm; string pStylePath=null; pStyGall=new ServerStyleGalleryClass(); pStyGallStor=pStyGall as IStyleGalleryStorage; try { pStylePath=pStyGallStor.DefaultStylePath+"Civic.ServerStyle"; pStyGallStor.TargetFile=pStylePath; //pStyGallStor.AddFile(pStylePath); //pStyGall.LoadStyle(pStylePath,""); ��������ʹ��LoadStyle������δָ���Ĵ��� pStyGallStor.AddFile(pStylePath); pEnumStyGallItm = pStyGall.get_Items("Marker Symbols",stylename,stylecategory); pEnumStyGallItm.Reset(); //Make sure it contains markers pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; //if(pStyGallItem==null) {MessageBox.Show("û��ָ����Symbol");return null;} //pEnumStyGallItm.Reset(); //Make sure it contains markers //pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; while(pStyGallItem!=null) { if(pStyGallItem.Name.Equals(symname)) { pMrkSym=pStyGallItem.Item as IMarkerSymbol; break; } pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; } return pMrkSym; } catch(Exception e) { MessageBox.Show(e.Message); return null; } finally{ pStyGallStor.RemoveFile(pStylePath); pStyGall=null; pStyGallStor=null; pStyGallItem=null; pEnumStyGallItm=null; } //return null; }
private void demo2(string CurrentStyleFile, string CurrentStyleGalleryClass) { IStyleGallery pStyleGallery = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage; pStyleGalleryStorage = pStyleGallery as IStyleGalleryStorage; //增加符号文件 pStyleGalleryStorage.AddFile(CurrentStyleFile); //根据当前符号的类别和文件得到符号的枚举循环 //符号类别包括Fill Symbol,Line Symbol等 IEnumStyleGalleryItem mEnumStyleItem; mEnumStyleItem = pStyleGallery.get_Items(CurrentStyleGalleryClass, CurrentStyleFile, ""); //得到符号文件类别的各个条目,增加到一个Combox中 IEnumBSTR pEnumBSTR = pStyleGallery.get_Categories(CurrentStyleGalleryClass); pEnumBSTR.Reset(); string Category = ""; Category = pEnumBSTR.Next(); while (Category != null) { //cbxCategory.Items.Add(Category); Category = pEnumBSTR.Next(); } //得到各个符号并转化为图片 mEnumStyleItem.Reset(); IStyleGalleryItem mStyleItem = mEnumStyleItem.Next(); int ImageIndex = 0; IStyleGalleryClass mStyleClass = new FillSymbolStyleGalleryClassClass(); while (mStyleItem != null) { //调用另一个类的方法将符号转化为图片 Bitmap bmpB = StyleGalleryItemToBmp(32, 32, mStyleClass, mStyleItem); Bitmap bmpS = StyleGalleryItemToBmp(16, 16, mStyleClass, mStyleItem); Largeimage.Images.Add(bmpB); Smallimage.Images.Add(bmpS); ListViewItem lvItem = new ListViewItem(new string[] { mStyleItem.Name, mStyleItem.ID.ToString(), mStyleItem.Category }, ImageIndex); this.lvRendererFields.Items.Add(lvItem); mStyleItem = mEnumStyleItem.Next(); ImageIndex++; } //必须采用此方式进行释放,第二次才能正常读取 System.Runtime.InteropServices.Marshal.ReleaseComObject(mEnumStyleItem); }
public static IMarkerSymbol FindMarkerSym(string stylename, string stylecategory, string symname) { //查找Symbol无法实现,StyleGallery属于Desktop IStyleGallery pStyGall; IStyleGalleryStorage pStyGallStor; IStyleGalleryItem pStyGallItem; IMarkerSymbol pMrkSym = null; IEnumStyleGalleryItem pEnumStyGallItm; string pStylePath = null; pStyGall = new ServerStyleGalleryClass(); pStyGallStor = pStyGall as IStyleGalleryStorage; try { pStylePath = pStyGallStor.DefaultStylePath + "Civic.ServerStyle"; pStyGallStor.TargetFile = pStylePath; //pStyGallStor.AddFile(pStylePath); //pStyGall.LoadStyle(pStylePath,""); 看来不能使用LoadStyle,出现未指定的错误 pStyGallStor.AddFile(pStylePath); pEnumStyGallItm = pStyGall.get_Items("Marker Symbols", stylename, stylecategory); pEnumStyGallItm.Reset(); //Make sure it contains markers pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; //if(pStyGallItem==null) {MessageBox.Show("没有指定的Symbol");return null;} //pEnumStyGallItm.Reset(); //Make sure it contains markers //pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; while (pStyGallItem != null) { if (pStyGallItem.Name.Equals(symname)) { pMrkSym = pStyGallItem.Item as IMarkerSymbol; break; } pStyGallItem = pEnumStyGallItm.Next() as IStyleGalleryItem; } return(pMrkSym); } catch (Exception e) { MessageBox.Show(e.Message); return(null); } finally{ pStyGallStor.RemoveFile(pStylePath); pStyGall = null; pStyGallStor = null; pStyGallItem = null; pEnumStyGallItm = null; } //return null; }
///<summary> ///��ȡ���ſ��з��� ///</summary> ///<param name="sServerStylePath">���ſ�ȫ·������</param> ///<param name="sGalleryClassName">GalleryClass����</param> ///<param name="symbolName">��������</param> ///<returns>����</returns> private ISymbol GetSymbol(string sServerStylePath, string sGalleryClassName, string symbolName) { try { //ServerStyleGallery���� IStyleGallery pStyleGaller = new ServerStyleGalleryClass(); IStyleGalleryStorage pStyleGalleryStorage = pStyleGaller as IStyleGalleryStorage; IEnumStyleGalleryItem pEnumSyleGalleryItem = null; IStyleGalleryItem pStyleGallerItem = null; IStyleGalleryClass pStyleGalleryClass = null; //ʹ��IStyleGalleryStorage�ӿڵ�AddFile��������ServerStyle�ļ� pStyleGalleryStorage.AddFile(sServerStylePath); //����ServerGallery�е�Class for (int i = 0; i < pStyleGaller.ClassCount; i++) { pStyleGalleryClass = pStyleGaller.get_Class(i); if (pStyleGalleryClass.Name != sGalleryClassName) continue; //��ȡEnumStyleGalleryItem���� pEnumSyleGalleryItem = pStyleGaller.get_Items(sGalleryClassName, sServerStylePath, ""); pEnumSyleGalleryItem.Reset(); //����pEnumSyleGalleryItem pStyleGallerItem = pEnumSyleGalleryItem.Next(); while (pStyleGallerItem != null) { if (pStyleGallerItem.Name == symbolName) { //��ȡ���� ISymbol pSymbol = pStyleGallerItem.Item as ISymbol; System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem); System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass); return pSymbol; } pStyleGallerItem = pEnumSyleGalleryItem.Next(); } } System.Runtime.InteropServices.Marshal.ReleaseComObject(pEnumSyleGalleryItem); System.Runtime.InteropServices.Marshal.ReleaseComObject(pStyleGalleryClass); return null; } catch (Exception Err) { MessageBox.Show(Err.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); return null; } }