on 12-20-2010 3:38 AM
通过 addmenus.xml 在B One里加载菜单栏.
addmenus.xml 内容:
<Application>
<Menus>
<action type="add">
<Menu Checked="0" Enabled="1" FatherUID="43520" Image="title.bmp" Position="14" String="Menus" Type="2" UniqueID="Menus">
<Menus>
<action type="add">
<Menu Checked="0" Enabled="1" FatherUID="Menus" Image="" Position="0" String="Menu_1" Type="1" UniqueID="Menu_1" />
</action>
</Menus>
</Menu>
</action>
</Menus>
</Application>
在Image属性中填写路径下的图标文件..运行报错.. Error -11003:Menu-Fail loading Image file
求助..怎么在addmenus.xml里菜单栏加图标. 谢谢.
有任何提示也请告知, 参与讨论谢谢.
您好,可以使用下面的代码,这也是本人和众多parnter使用的比较好的业务实践:
(假设你的xml 和 bmp位置在.net 工程 exe目录\bin\Debug下面的话)
string myxml = System.Environment.CurrentDirectory + "
myxml.xml";
string mypic = System.Environment.CurrentDirectory + "
mypic.bmp";
XmlDocument doc1 = new XmlDocument();
doc1.Load(myxml);
string temp = doc1.InnerXml;
//这里假设你原来的xml里面使用 "Image = mypic.bmp"
string targetstr = "Image=\"mypic.bmp\"";
string newstr = "Image=\"" + mypic + "\"";
int pos = temp.IndexOf(targetstr);
temp = temp.Replace(targetstr, newstr);
SBO_Application.LoadBatchActions(ref temp);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
您可以使用System.Environment.CurrentDirectory (.NET)环境中获得Add-On运行目录并加上指向该图片的相对路径。
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
在你的xml文件中,image 属性设置错误,应该填写你所加的image的绝对路径
比如:
<Application>
<Menus>
<action type="add">
<Menu Checked="0" Enabled="0" FatherUID="43520" String="MyMenu1" Type="2" UniqueID="MyMenu1" Image="C:/MyPic.bmp">
<Menus>
<action type="add">
<Menu Checked="1" Enabled="0" FatherUID="MyMenu1" String="MySub1" Type="1" UniqueID="MySub1" />
</action>
</Menus>
</Menu>
<Menu Checked="0" Enabled="1" FatherUID="43520" String="MyMenu2" Type="2" UniqueID="MyMenu2" >
<Menus>
<action type="add">
<Menu Checked="0" Enabled="0" Position="0" FatherUID="MyMenu2" String="MySub21" Type="1" UniqueID="MySub21" />
</action>
</Menus>
</Menu>
</action>
</Menus>
</Application>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.