Vhati
Aug 5th, 2005, 12:09 PM
Hey, I have a custom visio tool bar and i have created a custom .ico file that i want displayed on it
the ToolBarItem class has a .IconFileName method that supports a string file path and loads the icon just fine. However, due to deployment issues i would like to have the file loaded from a resource file (.res). I tried this:
Dim oToolBarItem as ToolBarItem
Set oToolBarItem = oToolBarItems.Add
With oToolBarItem
'bunch of other stuff, then:
Dim pic As IPictureDisp
Set pic = LoadResPicture("ALERT", 1)
SavePicture pic, "C:\ALERT.ICO"
.IconFileName "C:\ALERT.ICO"
the code runs fine without erroring, but the icon just shows up as a black square! Also the root directory is obviously a bad place to save the icon to and load it, how would i go about accessing a folder under the application path? Is there a better way to do this without saving and loading a file? any help would be wonderful, thanks!
the ToolBarItem class has a .IconFileName method that supports a string file path and loads the icon just fine. However, due to deployment issues i would like to have the file loaded from a resource file (.res). I tried this:
Dim oToolBarItem as ToolBarItem
Set oToolBarItem = oToolBarItems.Add
With oToolBarItem
'bunch of other stuff, then:
Dim pic As IPictureDisp
Set pic = LoadResPicture("ALERT", 1)
SavePicture pic, "C:\ALERT.ICO"
.IconFileName "C:\ALERT.ICO"
the code runs fine without erroring, but the icon just shows up as a black square! Also the root directory is obviously a bad place to save the icon to and load it, how would i go about accessing a folder under the application path? Is there a better way to do this without saving and loading a file? any help would be wonderful, thanks!