BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

howto set tranparent bitmap to outlook/word/access/excel com

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Harald Binkle
Guest





PostPosted: Fri Apr 08, 2005 1:47 pm    Post subject: howto set tranparent bitmap to outlook/word/access/excel com Reply with 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
Dmitry Streblechenko
Guest





PostPosted: Fri Apr 08, 2005 6:37 pm    Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel Reply with 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

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





PostPosted: Mon Apr 11, 2005 12:07 pm    Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel Reply with 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...
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





PostPosted: Mon Apr 11, 2005 12:27 pm    Post subject: Re: howto set tranparent bitmap to outlook/word/access/excel Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.