几何尺寸与公差论坛

 找回密码
 注册
查看: 839|回复: 0

【转帖】add-in how to show in menu, but dont show icon

[复制链接]
发表于 2009-4-13 08:43:34 | 显示全部楼层 |阅读模式
add-in?? how to show in menu, but don't show icon
i have my add-in working!!! thanks to everyone for their help. i do have one final question though. i am putting together a help file. i would like "help" to appear in the drop down on the solidworks menu bar, but i don't want the icon to appear in the toolbar. how can i go about this? like usual, any help is appreciated.
thanks!
tony szuta
cswa, cswp, cswp-smtl
being a bit lazy today so not even looking in the api, but off the top of my head, you can create a bitmap that is 16x16px with all pixels being the transparent color, and set it to that, effectively creating a transparent icon.
there is probably a proper way to do this though, i presume its simply not setting the icon by passing nothing/null instead, or setting index to -1 so something similar.
i have tried a few different things including your idea luke but i have had no luck. when i set the icon to nothing, it is represented by an empty black square. i have contacted api support and have had an sr# assigned. if anyone has any suggestions before their response, please feel free to post.
tony szuta
cswa, cswp, cswp-smtl
tony,
maybe i an missing something, but have you already put a menu item in sw help menu? i have seen a help page in api regarding that.
regards, basil
"and when you loose control,
you'll reap the harvest you have sown..." (c) pink floyd
solidworks 2008 x64 sp5.0 (production)
solidworks 2009 x64 sp2.0 (testing)
windows xp x64 sp2
core2quad 6600, 4gb ram, 500gb sata, ati firegl v7700 1024mb (softmodded from hd3850), 19" tft
hi tony
as i don't know how you've create your menu (i believe you've used the commandgroup interface). you can use the addmenuitem3 method to had an entry in your menu with no icon. it work, i've starting to use it.
hope this help
################################
stef
designer / cad administrator
sw 2007 sp5 winxp pro sp2
here is the code that i have used. it is direct from the vb.net add-in template. i just changed it to suit my needs.
public sub addcommandmgr()
dim cmdgroup as icommandgroup
dim ibmp as new bitmaphandler
dim thisassembly as assembly
thisassembly = system.reflection.assembly.getassembly(me.gettype())
cmdgroup = icmdmgr.createcommandgroup(1, "emteq", "emteq add-in", "", -1)
cmdgroup.largeiconlist = ibmp.createfilefromresourcebitmap("emteq.toolbarlarge.bmp")
cmdgroup.smalliconlist = ibmp.createfilefromresourcebitmap("emteq.toolbarsmall.bmp")
cmdgroup.largemainicon = ibmp.createfilefromresourcebitmap("emteq.mainiconlarge.bmp")
cmdgroup.smallmainicon = ibmp.createfilefromresourcebitmap("emteq.mainiconsmall.bmp")
cmdgroup.addcommanditem("custom properties", 0, "add and modify custom properties", "custom properties", 0, "customproperties", "", 0)
cmdgroup.addcommanditem("pdf creator", 1, "create pdf from current drawing", "pdf creator", 1, "pdfcreator", "", 1)
cmdgroup.addcommanditem("part number generator", 2, "generate new part number", "generate new part number", 2, "generatepn", "", 2)
cmdgroup.addcommanditem("help", 4, "solidtools help", "solidtools help", 3, "help", "", 3)
cmdgroup.addcommanditem("check for updates", 3, "check for solidtools updates", "check for solidtools updates", 4, "checkforupdates", "", 4)
cmdgroup.hastoolbar = true
cmdgroup.hasmenu = true
cmdgroup.activate()
thisassembly = nothing
ibmp.dispose()
end sub
i have attached an image of my menu and tool bar. i don't want the help icon to show on the tool bar. i will examine "addmenuitem3" stéphane.
thanks!
tony szuta
cswa, cswp, cswp-smtl
answer stéphane,
addcommanditem2 worked for me.
thanks to all!
tony szuta
cswa, cswp, cswp-smtl
hi tony
which colors do you've used for the background of your icon? in the api help they said you need to set it to rgb: 192,192,192 but i've a grey background. i fyou can help me......
hope this help
################################
stef
designer / cad administrator
sw 2007 sp5 winxp pro sp2
the most common transparency key is magenta, so try that (255 000 255)
hey tony,
i too am just starting into the api and would like to also add a custom pulldown menu with my addin. i have the 'swaddin template 1.3 setup' template but this doesn't contain any example code for this pulldown menu (that i can see). i see your code posted here and i think i'll be able to borrow and modify. i hate to sound totally clueless but what do i do with this code and where do i put it into the 'swaddin template?
if someone could point me into the right direction or offer a barbones example project with pulldowns like tony posted in the picture above.... i would greatly appreciate it!!!!! i really want to learn how to this!
i should also mention i tried this in vb 6. but i noticed you did this in .net
do i need to have vs 2005 or 2008?
many thanks!
don
edited: 04/23/2008 at 07:07 pm by don van zile
i am going to look into the "transparent" color.
don,
i was not having problems adding the drop down. i wanted things to appear in the drop down, but not on the tool bar. the drop down is "standard code" in the vb.net ad-in template that i used.
tony szuta
cswa, cswp, cswp-smtl
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 22:58 , Processed in 0.037626 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表