A
Antonio Casilias
Hi
I'm trying to create CommandBarButton at toolbar.
I need a button with width = 80 and with 80x20 image on it; without captions.
But the button I've got has 16x16 squeezed image.
Here is my code:
CComQIPtr<Office::_CommandBarButton> spCmdButton(spNewBar);
ATLASSERT(spCmdButton);
//! Loading bitmap
HBITMAP hBmp =(HBITMAP)::LoadImage(_AtlModule.hInstance,
MAKEINTRESOURCE(faceId),IMAGE_BITMAP,80,20, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT );
// put bitmap into Clipboard
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
:eleteObject(hBmp);
spCmdButton->put_Width(80);
spCmdButton->put_Visible(VARIANT_TRUE);
spCmdButton->put_Caption(caption);
spCmdButton->put_Enabled(VARIANT_TRUE);
spCmdButton->put_TooltipText(tooltip);
spCmdButton->put_Tag(tag);
spCmdButton->put_Style(Office::msoButtonIcon);
//! Pasting bitmap
spCmdButton->PasteFace();
spNewCmdBar->put_Visible(VARIANT_TRUE);
Please, advice me to create my custom sized image.
I'm trying to create CommandBarButton at toolbar.
I need a button with width = 80 and with 80x20 image on it; without captions.
But the button I've got has 16x16 squeezed image.
Here is my code:
CComQIPtr<Office::_CommandBarButton> spCmdButton(spNewBar);
ATLASSERT(spCmdButton);
//! Loading bitmap
HBITMAP hBmp =(HBITMAP)::LoadImage(_AtlModule.hInstance,
MAKEINTRESOURCE(faceId),IMAGE_BITMAP,80,20, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT );
// put bitmap into Clipboard
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(CF_BITMAP, (HANDLE)hBmp);
::CloseClipboard();
:eleteObject(hBmp);
spCmdButton->put_Width(80);
spCmdButton->put_Visible(VARIANT_TRUE);
spCmdButton->put_Caption(caption);
spCmdButton->put_Enabled(VARIANT_TRUE);
spCmdButton->put_TooltipText(tooltip);
spCmdButton->put_Tag(tag);
spCmdButton->put_Style(Office::msoButtonIcon);
//! Pasting bitmap
spCmdButton->PasteFace();
spNewCmdBar->put_Visible(VARIANT_TRUE);
Please, advice me to create my custom sized image.