 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Harald Binkle Guest
|
Posted: Fri Apr 08, 2005 1:47 pm Post subject: howto set tranparent bitmap to outlook/word/access/excel com |
|
|
Hi,
i'm using this code to set a bitmap as icon to outlook commandbarbutton.
But now I'd like to have the bitmap transparent, but it doesn't work like in
other applications.
How to do this?
Harry
#########################
procedure BmpToMenuItem(resName: String; Button: TOfficeCommandBarButton);
var bmp:TBitmap;
begin
bmp:=TBitmap.Create;
try
bmp.LoadFromResourceName(HInstance,resName);
bmp.PixelFormat:= pf24bit;
bmp.Transparent:=true;
bmp.TransparentColor:= RGB(255, 0, 255);
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
end;
end;
###########################
--
|
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Fri Apr 08, 2005 6:37 pm Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel |
|
|
The same rules apply as in Delphi itself - the pixel at the lower left
corner is considered the transparent color for the whole bitmap.
Also note that in Outlook 2002 and up you can set the
CommandBarButton.Picture and Mask properties to an instance of the IPicture
object without using the clipboard.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Harald Binkle" <binkle (AT) jam-software (DOT) com> wrote
| Quote: | Hi,
i'm using this code to set a bitmap as icon to outlook commandbarbutton.
But now I'd like to have the bitmap transparent, but it doesn't work like
in other applications.
How to do this?
Harry
#########################
procedure BmpToMenuItem(resName: String; Button:
TOfficeCommandBarButton);
var bmp:TBitmap;
begin
bmp:=TBitmap.Create;
try
bmp.LoadFromResourceName(HInstance,resName);
bmp.PixelFormat:= pf24bit;
bmp.Transparent:=true;
bmp.TransparentColor:= RGB(255, 0, 255);
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
end;
end;
###########################
--
|
|
|
| Back to top |
|
 |
Harald Binkle Guest
|
Posted: Mon Apr 11, 2005 12:07 pm Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel |
|
|
Yes it should be that way, but it isn't.
I tried this:
###########################
procedure BmpToMenuItem(resName: String; Button: TOfficeCommandBarButton);
var bmp:TBitmap;
JamClipboard:TJamClipboard;
begin
bmp:=TBitmap.Create;
JamClipboard:=TJamClipboard.Create;
try
JamClipboard.Save;
bmp.LoadFromResourceName(HInstance,resName);
//bmp.Mask(bmp.TransparentColor);
bmp.Transparent:=true;
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
JamClipboard.Restore;
JamClipboard.Free;
end;
end;
############################
the transparent color of the bmp is RGB(255,0,255), and my icon are ugly
pink, not tansparent.
when I uncomment the line with bmp.Mask(bmp.TransparentColor); the correct
mask is seen as icon on the button.
In babelfish you convert your icon to bmp, why does it work there and not
here?
Harry
"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> schrieb im Newsbeitrag
news:4256cf75$1 (AT) newsgroups (DOT) borland.com...
| Quote: | The same rules apply as in Delphi itself - the pixel at the lower left
corner is considered the transparent color for the whole bitmap.
Also note that in Outlook 2002 and up you can set the
CommandBarButton.Picture and Mask properties to an instance of the
IPicture object without using the clipboard.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Harald Binkle" <binkle (AT) jam-software (DOT) com> wrote in message
news:42568b43 (AT) newsgroups (DOT) borland.com...
Hi,
i'm using this code to set a bitmap as icon to outlook commandbarbutton.
But now I'd like to have the bitmap transparent, but it doesn't work like
in other applications.
How to do this?
Harry
#########################
procedure BmpToMenuItem(resName: String; Button:
TOfficeCommandBarButton);
var bmp:TBitmap;
begin
bmp:=TBitmap.Create;
try
bmp.LoadFromResourceName(HInstance,resName);
bmp.PixelFormat:= pf24bit;
bmp.Transparent:=true;
bmp.TransparentColor:= RGB(255, 0, 255);
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
end;
end;
###########################
--
|
|
|
| Back to top |
|
 |
Harald Binkle Guest
|
Posted: Mon Apr 11, 2005 12:27 pm Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel |
|
|
GOT IT,
the clue is the line:
bmp.Canvas.Brush.Color:=clBtnFace;
creating new bmp with clBtnFace as "backgroundcolor".
Harry
"Harald Binkle" <binkle (AT) jam-software (DOT) com> schrieb im Newsbeitrag
news:425a687f (AT) newsgroups (DOT) borland.com...
| Quote: | Yes it should be that way, but it isn't.
I tried this:
###########################
procedure BmpToMenuItem(resName: String; Button:
TOfficeCommandBarButton);
var bmp:TBitmap;
JamClipboard:TJamClipboard;
begin
bmp:=TBitmap.Create;
JamClipboard:=TJamClipboard.Create;
try
JamClipboard.Save;
bmp.LoadFromResourceName(HInstance,resName);
//bmp.Mask(bmp.TransparentColor);
bmp.Transparent:=true;
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
JamClipboard.Restore;
JamClipboard.Free;
end;
end;
############################
the transparent color of the bmp is RGB(255,0,255), and my icon are ugly
pink, not tansparent.
when I uncomment the line with bmp.Mask(bmp.TransparentColor); the correct
mask is seen as icon on the button.
In babelfish you convert your icon to bmp, why does it work there and not
here?
Harry
"Dmitry Streblechenko" <dmitry (AT) dimastr (DOT) com> schrieb im Newsbeitrag
news:4256cf75$1 (AT) newsgroups (DOT) borland.com...
The same rules apply as in Delphi itself - the pixel at the lower left
corner is considered the transparent color for the whole bitmap.
Also note that in Outlook 2002 and up you can set the
CommandBarButton.Picture and Mask properties to an instance of the
IPicture object without using the clipboard.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Harald Binkle" <binkle (AT) jam-software (DOT) com> wrote in message
news:42568b43 (AT) newsgroups (DOT) borland.com...
Hi,
i'm using this code to set a bitmap as icon to outlook commandbarbutton.
But now I'd like to have the bitmap transparent, but it doesn't work
like in other applications.
How to do this?
Harry
#########################
procedure BmpToMenuItem(resName: String; Button:
TOfficeCommandBarButton);
var bmp:TBitmap;
begin
bmp:=TBitmap.Create;
try
bmp.LoadFromResourceName(HInstance,resName);
bmp.PixelFormat:= pf24bit;
bmp.Transparent:=true;
bmp.TransparentColor:= RGB(255, 0, 255);
Clipboard.Assign(bmp);
Button.SetStyle(msoButtonIconAndCaption);
Button.PasteFace;
Clipboard.Clear;
finally
bmp.Free;
end;
end;
###########################
--
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|