CUSTOM Office Toolbar Button Icons using VBA

CUSTOM Office Toolbar Button Icons using VBA

Post by Tom Collin » Wed, 24 May 2000 04:00:00



I wanted to be able to make my own Office toolbar buttons on the fly
including a custom icon for it. Since I couldn't find anything like this
already I decided to do it myself.
I'm going to make an add-in that includes a full featured icon editor, that
instead of saving to a file, will insert an array of values into your code
that represents the pixels, and code that will use an array to 'paste' the
pixels onto the button. When I'm done, I'll put it on a web site for
distribution as freeware.
I know how to do most of it and can figure out the rest, but thought it
would be easier to ask.

Here's my plans so far...
Use an existing icon editor and modify it to use 16x16 and output the array.
I want to be able to copy, paste, move, flip, and rotate the entire image or
just a selection. I want to output the array directly into the current
module as a sub that includes the code to paste it.
I want it to have the capability of 256 colors but no more as that should be
sufficient and I want it to be compatible with those people running 256
colors on their machine. There are several icon editors out there that
between them have the features I want. So I'll just do a little mix and
match.
The image is put on the button by building it in memory, copying it to the
Clipboard, and then pasting it onto the button. The first 2 parts are done
using API calls. The last is a built in method.

Here's what I still need help on...
Setting the transparency color in the image.
Where I can find the RGB values for the standard 256 colors. Looking for a
mathematical relationship, not a lookup table.
Rolling all this into an add-in.

Suggestions...
The best idea I've come up with so far for storing the pixel values, so as
not to be too bulky, is to put them into 16 rows of 16 elements of an Array
function. i.e. PixelRow1 = Array(34, 151, 0, 0, ...). If anyone has a better
idea, please let me know.

If anyone has any suggestions or code they'd like to share, it be much
appreciated. Any help I use will be mentioned in the credits. Although, I
could probably do this in a full day, it'll probably take a couple of weeks
of fitting in an hour here and there. For any of those that help me out, if
you'd like to also be a guinea pig, I mean beta tester, let me know.

***************************************
This message is cross posted to several NGs that have to do with Office
development or Windows API, so don't reply as a post unless you feel it's
beneficial to all. Please email me instead. Thanks.
***************************************

--

Tom Collins

P.S. Of course, if someone else has already done this, or part of it, please
let me know. I have no desire to reinvent the wheel.

 
 
 

CUSTOM Office Toolbar Button Icons using VBA

Post by michk » Wed, 24 May 2000 04:00:00


Just one thing to consider in your plan:

One of the most ANNOYING things you can do is force the clipboard to be
cleared when someone starts up the app in which your add-in runs. Maybe you
need to move away from the clipboard to avoid this particular annoyance
(there are apps that do it now for their own icons and people already
complain all the time!).

--
MichKa
"Cause it's a bittersweet symphony, thats life..."  -- The Verve

random junk of dubious value, at the multilingual,
no scripts required, http://www.trigeminal.com/


> I wanted to be able to make my own Office toolbar buttons on the fly
> including a custom icon for it. Since I couldn't find anything like this
> already I decided to do it myself.
> I'm going to make an add-in that includes a full featured icon editor,
that
> instead of saving to a file, will insert an array of values into your code
> that represents the pixels, and code that will use an array to 'paste' the
> pixels onto the button. When I'm done, I'll put it on a web site for
> distribution as freeware.
> I know how to do most of it and can figure out the rest, but thought it
> would be easier to ask.

> Here's my plans so far...
> Use an existing icon editor and modify it to use 16x16 and output the
array.
> I want to be able to copy, paste, move, flip, and rotate the entire image
or
> just a selection. I want to output the array directly into the current
> module as a sub that includes the code to paste it.
> I want it to have the capability of 256 colors but no more as that should
be
> sufficient and I want it to be compatible with those people running 256
> colors on their machine. There are several icon editors out there that
> between them have the features I want. So I'll just do a little mix and
> match.
> The image is put on the button by building it in memory, copying it to the
> Clipboard, and then pasting it onto the button. The first 2 parts are done
> using API calls. The last is a built in method.

> Here's what I still need help on...
> Setting the transparency color in the image.
> Where I can find the RGB values for the standard 256 colors. Looking for a
> mathematical relationship, not a lookup table.
> Rolling all this into an add-in.

> Suggestions...
> The best idea I've come up with so far for storing the pixel values, so as
> not to be too bulky, is to put them into 16 rows of 16 elements of an
Array
> function. i.e. PixelRow1 = Array(34, 151, 0, 0, ...). If anyone has a
better
> idea, please let me know.

> If anyone has any suggestions or code they'd like to share, it be much
> appreciated. Any help I use will be mentioned in the credits. Although, I
> could probably do this in a full day, it'll probably take a couple of
weeks
> of fitting in an hour here and there. For any of those that help me out,
if
> you'd like to also be a guinea pig, I mean beta tester, let me know.

> ***************************************
> This message is cross posted to several NGs that have to do with Office
> development or Windows API, so don't reply as a post unless you feel it's
> beneficial to all. Please email me instead. Thanks.
> ***************************************

> --

> Tom Collins

> P.S. Of course, if someone else has already done this, or part of it,
please
> let me know. I have no desire to reinvent the wheel.


 
 
 

CUSTOM Office Toolbar Button Icons using VBA

Post by Tom Collin » Wed, 24 May 2000 04:00:00


VERY good point. That would annoy me also. Any ideas? Maybe swap out
whatever's in there before my routine and swap it back in afterwards? Don't
know how easy it can be done, or even how.



: Just one thing to consider in your plan:
:
: One of the most ANNOYING things you can do is force the clipboard to be
: cleared when someone starts up the app in which your add-in runs. Maybe
you
: need to move away from the clipboard to avoid this particular annoyance
: (there are apps that do it now for their own icons and people already
: complain all the time!).
:
: --
: MichKa
: "Cause it's a bittersweet symphony, thats life..."  -- The Verve
:
: random junk of dubious value, at the multilingual,
: no scripts required, http://www.trigeminal.com/
:


: > I wanted to be able to make my own Office toolbar buttons on the fly
: > including a custom icon for it. Since I couldn't find anything like this
: > already I decided to do it myself.
: > I'm going to make an add-in that includes a full featured icon editor,
: that
: > instead of saving to a file, will insert an array of values into your
code
: > that represents the pixels, and code that will use an array to 'paste'
the
: > pixels onto the button. When I'm done, I'll put it on a web site for
: > distribution as freeware.
: > I know how to do most of it and can figure out the rest, but thought it
: > would be easier to ask.
: >
: > Here's my plans so far...
: > Use an existing icon editor and modify it to use 16x16 and output the
: array.
: > I want to be able to copy, paste, move, flip, and rotate the entire
image
: or
: > just a selection. I want to output the array directly into the current
: > module as a sub that includes the code to paste it.
: > I want it to have the capability of 256 colors but no more as that
should
: be
: > sufficient and I want it to be compatible with those people running 256
: > colors on their machine. There are several icon editors out there that
: > between them have the features I want. So I'll just do a little mix and
: > match.
: > The image is put on the button by building it in memory, copying it to
the
: > Clipboard, and then pasting it onto the button. The first 2 parts are
done
: > using API calls. The last is a built in method.
: >
: >
: > Here's what I still need help on...
: > Setting the transparency color in the image.
: > Where I can find the RGB values for the standard 256 colors. Looking for
a
: > mathematical relationship, not a lookup table.
: > Rolling all this into an add-in.
: >
: > Suggestions...
: > The best idea I've come up with so far for storing the pixel values, so
as
: > not to be too bulky, is to put them into 16 rows of 16 elements of an
: Array
: > function. i.e. PixelRow1 = Array(34, 151, 0, 0, ...). If anyone has a
: better
: > idea, please let me know.
: >
: >
: > If anyone has any suggestions or code they'd like to share, it be much
: > appreciated. Any help I use will be mentioned in the credits. Although,
I
: > could probably do this in a full day, it'll probably take a couple of
: weeks
: > of fitting in an hour here and there. For any of those that help me out,
: if
: > you'd like to also be a guinea pig, I mean beta tester, let me know.
: >
: > ***************************************
: > This message is cross posted to several NGs that have to do with Office
: > development or Windows API, so don't reply as a post unless you feel
it's
: > beneficial to all. Please email me instead. Thanks.
: > ***************************************
: >
: > --
: >
: > Tom Collins

: >
: >
: > P.S. Of course, if someone else has already done this, or part of it,
: please
: > let me know. I have no desire to reinvent the wheel.
: >
: >
: >
: >
: >
:
:

 
 
 

1. Need advice on the techniques used to add icons to my custom Acrobat toolbar

I am trying to add a set of nice icons to my custom (plugin-based)
Acrobat toolbar. The issues are those to be expected:

 - What dimensions are acceptable?
 - What color depth?
 - What graphic file format?
 - How do I handle transparency?

As a newbie, I just discovered that bitmaps (*.bmp) don't seem to
support 32 bit color (or transparency?)

My target is Windows XP, which apparently supports 32 bit color.

What I currently have is 24x24x24 bitmaps, but the background shows as
white.

TIA,

-Ramon

2. Web Graphics Usability

3. office toolbar icon not responding to change

4. CFP II Workshop on Database Issues for Visualization

5. Custom Toolbar Icons without the clipboard!

6. Calculating areas of Trimmed b-spline surfaces

7. Looking for a toolbar button/icon designer

8. I put a large skins chart up at Camp Ratty

9. Using custom picture for icons

10. Adding/Using custom icon with System Imagelist

11. Custom Animations in Microsoft PowerPoint en suite with Microsoft Office XP

12. Custom Toolbars?

13. Forms and custom borders, titlebar, toolbar etc.