阅读:1260回复:1
请教一个问题,几天来夜不能寐!!
<P>我用C#定制AO的时候,发现IMenuDef,IToolBarDef做出的无论是菜单还是工具条都出不来,程序都检查了几百次了,应该没有错误。请哪位大虾帮忙了</P>
<P>using System; using System.Drawing; using System.Runtime.InteropServices; using ESRI.ArcObjects.Core;</P> <P> namespace fuzhubianzhi { /// <summary> /// zongtitool 的摘要说明。 /// </summary> /// </P> <P> [ClassInterface(ClassInterfaceType.None)]</P> <P> [Guid("1BFB2A1E-2B2C-4359-94C5-0C131F60929D")]</P> <P> public class zongtitool : IToolBarDef {</P> <P> #region Component Category Registration</P> <P> [ComRegisterFunction]</P> <P> [ComVisible(false)]</P> <P> public static void RegisterFunction(Type t)</P> <P> {</P> <P> string sKey = @"\CLSID\{" + t.GUID.ToString() + @"}\Implemented Categories";</P> <P> Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot .OpenSubKey(sKey, true);</P> <P> if (regKey != null)</P> <P> {</P> <P> regKey.CreateSubKey("{B56A7C42-83D4-11D2-A2E9-080009B6F22B}");</P> <P> }</P> <P> }</P> <P> </P> <P> [ComUnregisterFunction]</P> <P> [ComVisible(false)]</P> <P> public static void UnregisterFunction(Type t)</P> <P> {</P> <P> string sKey = @"\CLSID\{" + t.GUID.ToString() + @"}\Implemented Categories";</P> <P> Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot .OpenSubKey(sKey, true);</P> <P> if (regKey != null)</P> <P> {</P> <P> regKey.DeleteSubKey("{B56A7C42-83D4-11D2-A2E9-080009B6F22B}");</P> <P> }</P> <P> }</P> <P> #endregion</P> <P> public zongtitool() { // // TOD 在此处添加构造函数逻辑 // } #region IToolBarDef 成员</P> <P> public void GetItemInfo(int pos, IItemDef itemDef) { // TOD 添加 zongtitool.GetItemInfo 实现</P> <P> switch(pos) { case 0 : itemDef.ID = "fuzhubianzhi.zongTiEditor"; itemDef.Group = false; break; default : break; // case 1: // itemDef.ID = "ESRI.ArcObjects.Samples.CatIDs.GxFeatureDatasetExportMenuCommand"; // itemDef.Group = false; // break; } }</P> <P> public string Caption { get { // TOD 添加 zongtitool.Caption getter 实现 return "zongtitools"; } }</P> <P> public string Name { get { // TOD 添加 zongtitool.Name getter 实现 return "zongtitools"; } }</P> <P> public int ItemCount { get { // TOD 添加 zongtitool.ItemCount getter 实现 return 1; } }</P> <P> #endregion } } </P> |
|
1楼#
发布于:2004-11-29 10:46
B56A7C42-83D4-11D2-A2E9-080009B6F22B--------有错
|
|