Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Transparent Inspector images

Geek News

Transparent Inspector images
Rog <rog_21[ at ]yahoo.com> 3/15/2006 3:11:58 PM
I am trying to add transparent images to CommandBarButtons in an
Inspector which of course doesn't use the mask property. I am using C#.
Does anyone have any suggestions?
Thanks
Re: Transparent Inspector images
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 3/15/2006 3:29:14 PM
Mask is supported for Outlook 2002 and later. It's only for Outlook 2000
that you need to use a workaround. Are you needing to support Outlook 2000?

The trick with Outlook 2000 is to use one color as a mask color, say
magenta. That color can only be used where you want masking. Then you do
some fancy stuff with the Win32 API and separate the mask and image and pop
them onto the clipboard and use PasteFace to add the button image.

See http://www.daveswebsite.com/articles/article1/default.shtml for a C++
example and KB288771 for a VB example. Offhand I'm not familiar with any C#
examples but there may be some out there if you Google for "PasteFace".

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Rog" <rog_21[ at ]yahoo.com> wrote in message
news:uvJ6PLESGHA.1948[ at ]TK2MSFTNGP09.phx.gbl...
[Quoted Text]
>I am trying to add transparent images to CommandBarButtons in an Inspector
>which of course doesn't use the mask property. I am using C#.
> Does anyone have any suggestions?
> Thanks

Re: Transparent Inspector images
Rog <rog_21[ at ]yahoo.com> 3/15/2006 3:41:02 PM
Thanks Ken, so the mask is supported even on the inspector for Outlook
2003? I know it works for the Explorer buttons.
Thanks

Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> Mask is supported for Outlook 2002 and later. It's only for Outlook 2000
> that you need to use a workaround. Are you needing to support Outlook 2000?
>
> The trick with Outlook 2000 is to use one color as a mask color, say
> magenta. That color can only be used where you want masking. Then you do
> some fancy stuff with the Win32 API and separate the mask and image and
> pop them onto the clipboard and use PasteFace to add the button image.
>
> See http://www.daveswebsite.com/articles/article1/default.shtml for a
> C++ example and KB288771 for a VB example. Offhand I'm not familiar with
> any C# examples but there may be some out there if you Google for
> "PasteFace".
>
Re: Transparent Inspector images
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 3/15/2006 6:57:19 PM
If you are using the Word editor (default in Outlook 2003), you cannot set
the image using Picture and Mask properties from a COM addin since IPicture
interface cannot be marshalled across the process boundaries (Word
inspectors run in the windword.exe process space), so you must use the
PasteFace method.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Rog" <rog_21[ at ]yahoo.com> wrote in message
news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl...
[Quoted Text]
> Thanks Ken, so the mask is supported even on the inspector for Outlook
> 2003? I know it works for the Explorer buttons.
> Thanks
>
> Ken Slovak - [MVP - Outlook] wrote:
>> Mask is supported for Outlook 2002 and later. It's only for Outlook 2000
>> that you need to use a workaround. Are you needing to support Outlook
>> 2000?
>>
>> The trick with Outlook 2000 is to use one color as a mask color, say
>> magenta. That color can only be used where you want masking. Then you do
>> some fancy stuff with the Win32 API and separate the mask and image and
>> pop them onto the clipboard and use PasteFace to add the button image.
>>
>> See http://www.daveswebsite.com/articles/article1/default.shtml for a C++
>> example and KB288771 for a VB example. Offhand I'm not familiar with any
>> C# examples but there may be some out there if you Google for
>> "PasteFace".
>>


Re: Transparent Inspector images
Rog <rog_21[ at ]yahoo.com> 3/15/2006 8:51:32 PM
Thanks Dmitry, that then supports what I saw when I tried to the use
mask on the Button and get an exception.
Do you know how I can get a transparent image onto the CommandBarButton
using PasteFace then. I used magenta and green as the background, but it
does not work. I am using C#.
Thanks,
Rog


Dmitry Streblechenko wrote:
[Quoted Text]
> If you are using the Word editor (default in Outlook 2003), you cannot set
> the image using Picture and Mask properties from a COM addin since IPicture
> interface cannot be marshalled across the process boundaries (Word
> inspectors run in the windword.exe process space), so you must use the
> PasteFace method.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Rog" <rog_21[ at ]yahoo.com> wrote in message
> news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl...
>> Thanks Ken, so the mask is supported even on the inspector for Outlook
>> 2003? I know it works for the Explorer buttons.
>> Thanks
>>
>> Ken Slovak - [MVP - Outlook] wrote:
>>> Mask is supported for Outlook 2002 and later. It's only for Outlook 2000
>>> that you need to use a workaround. Are you needing to support Outlook
>>> 2000?
>>>
>>> The trick with Outlook 2000 is to use one color as a mask color, say
>>> magenta. That color can only be used where you want masking. Then you do
>>> some fancy stuff with the Win32 API and separate the mask and image and
>>> pop them onto the clipboard and use PasteFace to add the button image.
>>>
>>> See http://www.daveswebsite.com/articles/article1/default.shtml for a C++
>>> example and KB288771 for a VB example. Offhand I'm not familiar with any
>>> C# examples but there may be some out there if you Google for
>>> "PasteFace".
>>>
>
>
Re: Transparent Inspector images
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 3/15/2006 9:26:13 PM
I usually create a temp bitmap, paint the background with the current
scheme's dialog background color, then paint an icon on top of it.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Rog" <rog_21[ at ]yahoo.com> wrote in message
news:%23J%23E$IHSGHA.5908[ at ]TK2MSFTNGP14.phx.gbl...
[Quoted Text]
> Thanks Dmitry, that then supports what I saw when I tried to the use mask
> on the Button and get an exception.
> Do you know how I can get a transparent image onto the CommandBarButton
> using PasteFace then. I used magenta and green as the background, but it
> does not work. I am using C#.
> Thanks,
> Rog
>
>
> Dmitry Streblechenko wrote:
>> If you are using the Word editor (default in Outlook 2003), you cannot
>> set the image using Picture and Mask properties from a COM addin since
>> IPicture interface cannot be marshalled across the process boundaries
>> (Word inspectors run in the windword.exe process space), so you must use
>> the PasteFace method.
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Rog" <rog_21[ at ]yahoo.com> wrote in message
>> news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl...
>>> Thanks Ken, so the mask is supported even on the inspector for Outlook
>>> 2003? I know it works for the Explorer buttons.
>>> Thanks
>>>
>>> Ken Slovak - [MVP - Outlook] wrote:
>>>> Mask is supported for Outlook 2002 and later. It's only for Outlook
>>>> 2000 that you need to use a workaround. Are you needing to support
>>>> Outlook 2000?
>>>>
>>>> The trick with Outlook 2000 is to use one color as a mask color, say
>>>> magenta. That color can only be used where you want masking. Then you
>>>> do some fancy stuff with the Win32 API and separate the mask and image
>>>> and pop them onto the clipboard and use PasteFace to add the button
>>>> image.
>>>>
>>>> See http://www.daveswebsite.com/articles/article1/default.shtml for a
>>>> C++ example and KB288771 for a VB example. Offhand I'm not familiar
>>>> with any C# examples but there may be some out there if you Google for
>>>> "PasteFace".
>>>>
>>

Re: Transparent Inspector images
"Dave Kane [MVP - Outlook]" <dkane[ at ]mvps.org> 3/15/2006 9:45:39 PM
This is a multi-part message in MIME format.

------=_NextPart_000_0021_01C64836.BFA58F10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

One option is to translate the C++ example that Ken pointed you to, =
which creates a transparent icon on the clipboard that you can use for =
PasteFace.=20

Another option is to create a transparent icon and save it in a resource =
file in your assembly. When you need the image for your command bar =
button you can extract the icon resource as a Drawing.Icon object, call =
the Icon object's ToBitmap method to get a bitmap, and copy that to the =
clipboard where you can use it for PasteFace.

You have to be careful when using the Clipboard not to clobber whatever =
data the user might currently have stored on it. Here is a VB.NET =
procedure that maintains the existing content when using PasteFace

''' <summary>
''' Preserve contents of clipboard while using PastFace to set button =
image

''' </summary>

''' <param name=3D"cbb">CommandBar button getting the image</param>

''' <param name=3D"bmpImage">Bitmap applied as button image</param>

Private Sub PasteImage(ByVal cbb As CommandBarButton, ByVal bmpImage As =
Drawing.Bitmap)

Try

'save current data (in all of its formats) on the clipboard;=20

'don't interfere with user pasting something into a new email

Dim clipData As System.Windows.Forms.IDataObject =3D _ =
System.Windows.Forms.Clipboard.GetDataObject

Dim astrFormats() As String =3D clipData.GetFormats(False)

Dim savedData As System.Windows.Forms.IDataObject =3D New =
System.Windows.Forms.DataObject

Dim i As Integer

' add data to new data object in reverse order=20

' that's how it went into current object

For i =3D astrFormats.Length - 1 To 0 Step -1

savedData.SetData(astrFormats(i), =
clipData.GetData(astrFormats(i)))

Next

System.Windows.Forms.Clipboard.SetDataObject(bmpImage, False)

'PasteFace copies image to our button

cbb.PasteFace()

'restore original data to clipboard

System.Windows.Forms.Clipboard.SetDataObject(savedData)

Catch ex As Exception

'exception handling here

End Try

End Sub


"Rog" <rog_21[ at ]yahoo.com> wrote in message =
news:%23J%23E$IHSGHA.5908[ at ]TK2MSFTNGP14.phx.gbl...
[Quoted Text]
> Thanks Dmitry, that then supports what I saw when I tried to the use=20
> mask on the Button and get an exception.
> Do you know how I can get a transparent image onto the =
CommandBarButton=20
> using PasteFace then. I used magenta and green as the background, but =
it=20
> does not work. I am using C#.
> Thanks,
> Rog
>=20
>=20
> Dmitry Streblechenko wrote:
>> If you are using the Word editor (default in Outlook 2003), you =
cannot set=20
>> the image using Picture and Mask properties from a COM addin since =
IPicture=20
>> interface cannot be marshalled across the process boundaries (Word=20
>> inspectors run in the windword.exe process space), so you must use =
the=20
>> PasteFace method.
>>=20
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>=20
>> "Rog" <rog_21[ at ]yahoo.com> wrote in message=20
>> news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl...
>>> Thanks Ken, so the mask is supported even on the inspector for =
Outlook=20
>>> 2003? I know it works for the Explorer buttons.
>>> Thanks
>>>
>>> Ken Slovak - [MVP - Outlook] wrote:
>>>> Mask is supported for Outlook 2002 and later. It's only for Outlook =
2000=20
>>>> that you need to use a workaround. Are you needing to support =
Outlook=20
>>>> 2000?
>>>>
>>>> The trick with Outlook 2000 is to use one color as a mask color, =
say=20
>>>> magenta. That color can only be used where you want masking. Then =
you do=20
>>>> some fancy stuff with the Win32 API and separate the mask and image =
and=20
>>>> pop them onto the clipboard and use PasteFace to add the button =
image.
>>>>
>>>> See http://www.daveswebsite.com/articles/article1/default.shtml for =
a C++=20
>>>> example and KB288771 for a VB example. Offhand I'm not familiar =
with any=20
>>>> C# examples but there may be some out there if you Google for=20
>>>> "PasteFace".
>>>>
>>=20
>>
------=_NextPart_000_0021_01C64836.BFA58F10
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2802" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>One option is to translate the  C++ example that Ken pointed =
you to,=20
which creates a transparent icon on the clipboard that you can use for=20
PasteFace. </DIV>
<DIV> </DIV>
<DIV>Another option is to create a transparent icon and save it=20
in a resource file in your assembly. When you need the image =
for your=20
command bar button you can extract the icon resource as a =
Drawing.Icon=20
object, call the Icon object's ToBitmap method to get a bitmap, and copy =
that to=20
the clipboard where you can use it for PasteFace.</DIV>
<DIV> </DIV>
<DIV>You have to be careful when using the Clipboard not to clobber =
whatever=20
data the user might currently have stored on it. Here is a VB.NET =
procedure that=20
maintains the existing content when using PasteFace</DIV>
<DIV> </DIV><FONT size=3D2>
<DIV><FONT face=3D"Courier New" color=3D#008000>''' =
<summary></FONT></DIV>
<DIV>
<P></FONT><FONT size=3D2><FONT face=3D"Courier New" color=3D#008000>''' =
Preserve=20
contents of clipboard while using PastFace to set button=20
image</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier New">'''=20
</summary></FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier New">''' =
<param=20
name=3D"cbb">CommandBar button getting the=20
image</param></FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier New">''' =
<param=20
name=3D"bmpImage">Bitmap applied as button=20
image</param></FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff=20
size=3D2>Private</FONT><FONT size=3D2> </FONT><FONT color=3D#0000ff=20
size=3D2>Sub</FONT><FONT size=3D2> PasteImage(</FONT><FONT =
color=3D#0000ff=20
size=3D2>ByVal</FONT><FONT size=3D2> cbb </FONT><FONT color=3D#0000ff=20
size=3D2>As</FONT><FONT size=3D2> CommandBarButton, </FONT><FONT =
color=3D#0000ff=20
size=3D2>ByVal</FONT><FONT size=3D2> bmpImage </FONT><FONT =
color=3D#0000ff=20
size=3D2>As</FONT></FONT><FONT size=3D2><FONT face=3D"Courier New">=20
Drawing.Bitmap)</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#0000ff size=3D2><FONT face=3D"Courier =
New">   =20
Try</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    'save current data (in all of its formats) on the =
clipboard;=20
</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    'don't interfere with user pasting something into a =
new=20
email</FONT></FONT></P>
<P><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
    Dim</FONT><FONT size=3D2> clipData </FONT><FONT =
color=3D#0000ff=20
size=3D2>As</FONT></FONT><FONT size=3D2><FONT face=3D"Courier New">=20
System.Windows.Forms.IDataObject=20
=3D _          &nb=
sp; =20
System.Windows.Forms.Clipboard.GetDataObject</FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
    Dim</FONT><FONT size=3D2> astrFormats() </FONT><FONT=20
color=3D#0000ff size=3D2>As</FONT><FONT size=3D2> </FONT><FONT =
color=3D#0000ff=20
size=3D2>String</FONT><FONT size=3D2> =3D =
clipData.GetFormats(</FONT><FONT=20
color=3D#0000ff size=3D2>False</FONT></FONT><FONT size=3D2><FONT=20
face=3D"Courier New">)</FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
    Dim</FONT><FONT size=3D2> savedData </FONT><FONT =
color=3D#0000ff=20
size=3D2>As</FONT><FONT size=3D2> System.Windows.Forms.IDataObject =3D =
</FONT><FONT=20
color=3D#0000ff size=3D2>New</FONT></FONT><FONT size=3D2><FONT =
face=3D"Courier New">=20
System.Windows.Forms.DataObject</FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
    Dim</FONT><FONT size=3D2> i </FONT><FONT =
color=3D#0000ff=20
size=3D2>As</FONT><FONT size=3D2> </FONT><FONT color=3D#0000ff=20
size=3D2>Integer</P></FONT></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    ' add data to new data object in reverse order=20
</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    ' that's how it went into current=20
object</FONT></P></FONT><FONT size=3D2>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
    For</FONT><FONT size=3D2> i =3D astrFormats.Length - =
1=20
</FONT><FONT color=3D#0000ff size=3D2>To</FONT><FONT size=3D2> 0 =
</FONT><FONT=20
color=3D#0000ff size=3D2>Step</FONT></FONT><FONT size=3D2><FONT =
face=3D"Courier New">=20
-1</FONT></P>
<P><FONT face=3D"Courier New">       =20
    savedData.SetData(astrFormats(i),=20
clipData.GetData(astrFormats(i)))</FONT></P>
<P></FONT><FONT color=3D#0000ff size=3D2><FONT face=3D"Courier =
New">   =20
    Next</FONT></P></FONT><FONT size=3D2>
<P><FONT face=3D"Courier New">       =20
System.Windows.Forms.Clipboard.SetDataObject(bmpImage, =
</FONT></FONT><FONT=20
face=3D"Courier New" color=3D#0000ff size=3D2>False</FONT><FONT =
size=3D2><FONT=20
face=3D"Courier New">)</FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    'PasteFace copies image to our =
button</FONT></FONT></P>
<P><FONT size=3D2><FONT face=3D"Courier New">    =
   =20
cbb.PasteFace()</FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3D"Courier =
New">   =20
    'restore original data to =
clipboard</FONT></P></FONT><FONT=20
size=3D2>
<P><FONT face=3D"Courier New">       =20
System.Windows.Forms.Clipboard.SetDataObject(savedData)</FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
Catch</FONT><FONT size=3D2> ex </FONT><FONT color=3D#0000ff=20
size=3D2>As</FONT></FONT><FONT size=3D2><FONT face=3D"Courier New">=20
Exception</FONT></P>
<P><FONT face=3D"Courier New">    <FONT=20
color=3D#008000>    </FONT><FONT =
color=3D#008000>'exception handling=20
here</FONT></FONT></P>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>   =20
End</FONT><FONT size=3D2> </FONT><FONT color=3D#0000ff=20
size=3D2>Try</P></FONT></FONT><FONT size=3D2>
<P></FONT><FONT face=3D"Courier New"><FONT color=3D#0000ff =
size=3D2>End</FONT><FONT=20
size=3D2> </FONT><FONT color=3D#0000ff =
size=3D2>Sub</P></FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"Rog" <<A =
href=3D"mailto:rog_21[ at ]yahoo.com">rog_21[ at ]yahoo.com</A>> wrote=20
in message <A=20
href=3D"news:%23J%23E$IHSGHA.5908[ at ]TK2MSFTNGP14.phx.gbl">news:%23J%23E$IHS=
GHA.5908[ at ]TK2MSFTNGP14.phx.gbl</A>...</DIV>>=20
Thanks Dmitry, that then supports what I saw when I tried to the use =
<BR>>=20
mask on the Button and get an exception.<BR>> Do you know how I can =
get a=20
transparent image onto the CommandBarButton <BR>> using PasteFace =
then. I=20
used magenta and green as the background, but it <BR>> does not work. =
I am=20
using C#.<BR>> Thanks,<BR>> Rog<BR>> <BR>> <BR>> Dmitry=20
Streblechenko wrote:<BR>>> If you are using the Word editor =
(default in=20
Outlook 2003), you cannot set <BR>>> the image using Picture and =
Mask=20
properties from a COM addin since IPicture <BR>>> interface cannot =
be=20
marshalled across the process boundaries (Word <BR>>> inspectors =
run in=20
the windword.exe process space), so you must use the <BR>>> =
PasteFace=20
method.<BR>>> <BR>>> Dmitry Streblechenko (MVP)<BR>>> =
<A=20
href=3D"http://www.dimastr.com/">http://www.dimastr.com/</A><BR>>> =

OutlookSpy  - Outlook, CDO<BR>>> and MAPI Developer =
Tool<BR>>>=20
<BR>>> "Rog" <<A=20
href=3D"mailto:rog_21[ at ]yahoo.com">rog_21[ at ]yahoo.com</A>> wrote in =
message=20
<BR>>> <A=20
href=3D"news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl">news:eiG4ebESGHA.4688=
[ at ]TK2MSFTNGP11.phx.gbl</A>...<BR>>>>=20
Thanks Ken, so the mask is supported even on the inspector for Outlook=20
<BR>>>> 2003? I know it works for the Explorer =
buttons.<BR>>>>=20
Thanks<BR>>>><BR>>>> Ken Slovak - [MVP - Outlook]=20
wrote:<BR>>>>> Mask is supported for Outlook 2002 and later. =
It's=20
only for Outlook 2000 <BR>>>>> that you need to use a =
workaround.=20
Are you needing to support Outlook <BR>>>>>=20
2000?<BR>>>>><BR>>>>> The trick with Outlook =
2000 is to=20
use one color as a mask color, say <BR>>>>> magenta. That =
color can=20
only be used where you want masking. Then you do <BR>>>>> =
some fancy=20
stuff with the Win32 API and separate the mask and image and=20
<BR>>>>> pop them onto the clipboard and use PasteFace to =
add the=20
button image.<BR>>>>><BR>>>>> See <A=20
href=3D"http://www.daveswebsite.com/articles/article1/default.shtml">http=
://www.daveswebsite.com/articles/article1/default.shtml</A>=20
for a C++ <BR>>>>> example and KB288771 for a VB example. =
Offhand=20
I'm not familiar with any <BR>>>>> C# examples but there may =
be some=20
out there if you Google for <BR>>>>>=20
"PasteFace".<BR>>>>><BR>>> <BR>>></BODY></HTML>

------=_NextPart_000_0021_01C64836.BFA58F10--

Re: Transparent Inspector images
Rog <rog_21[ at ]yahoo.com> 3/15/2006 9:52:55 PM
Thanks everyone, I will let you know what I end up doing.


Dave Kane [MVP - Outlook] wrote:
[Quoted Text]
> One option is to translate the C++ example that Ken pointed you to,
> which creates a transparent icon on the clipboard that you can use for
> PasteFace.
>
> Another option is to create a transparent icon and save it in a resource
> file in your assembly. When you need the image for your command bar
> button you can extract the icon resource as a Drawing.Icon object, call
> the Icon object's ToBitmap method to get a bitmap, and copy that to the
> clipboard where you can use it for PasteFace.
>
> You have to be careful when using the Clipboard not to clobber whatever
> data the user might currently have stored on it. Here is a VB.NET
> procedure that maintains the existing content when using PasteFace
>
> ''' <summary>
>
> ''' Preserve contents of clipboard while using PastFace to set button image
>
> ''' </summary>
>
> ''' <param name="cbb">CommandBar button getting the image</param>
>
> ''' <param name="bmpImage">Bitmap applied as button image</param>
>
> Private Sub PasteImage(ByVal cbb As CommandBarButton, ByVal bmpImage As
> Drawing.Bitmap)
>
> Try
>
> 'save current data (in all of its formats) on the clipboard;
>
> 'don't interfere with user pasting something into a new email
>
> Dim clipData As System.Windows.Forms.IDataObject = _
> System.Windows.Forms.Clipboard.GetDataObject
>
> Dim astrFormats() As String = clipData.GetFormats(False)
>
> Dim savedData As System.Windows.Forms.IDataObject = New
> System.Windows.Forms.DataObject
>
> Dim i As Integer
>
> ' add data to new data object in reverse order
>
> ' that's how it went into current object
>
> For i = astrFormats.Length - 1 To 0 Step -1
>
> savedData.SetData(astrFormats(i),
> clipData.GetData(astrFormats(i)))
>
> Next
>
> System.Windows.Forms.Clipboard.SetDataObject(bmpImage, False)
>
> 'PasteFace copies image to our button
>
> cbb.PasteFace()
>
> 'restore original data to clipboard
>
> System.Windows.Forms.Clipboard.SetDataObject(savedData)
>
> Catch ex As Exception
>
> 'exception handling here
>
> End Try
>
> End Sub
>
>
> "Rog" <rog_21[ at ]yahoo.com <mailto:rog_21[ at ]yahoo.com>> wrote in message
> news:%23J%23E$IHSGHA.5908[ at ]TK2MSFTNGP14.phx.gbl...
> > Thanks Dmitry, that then supports what I saw when I tried to the use
> > mask on the Button and get an exception.
> > Do you know how I can get a transparent image onto the CommandBarButton
> > using PasteFace then. I used magenta and green as the background, but it
> > does not work. I am using C#.
> > Thanks,
> > Rog
> >
> >
> > Dmitry Streblechenko wrote:
> >> If you are using the Word editor (default in Outlook 2003), you
> cannot set
> >> the image using Picture and Mask properties from a COM addin since
> IPicture
> >> interface cannot be marshalled across the process boundaries (Word
> >> inspectors run in the windword.exe process space), so you must use the
> >> PasteFace method.
> >>
> >> Dmitry Streblechenko (MVP)
> >> http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
> >>
> >> "Rog" <rog_21[ at ]yahoo.com <mailto:rog_21[ at ]yahoo.com>> wrote in message
> >> news:eiG4ebESGHA.4688[ at ]TK2MSFTNGP11.phx.gbl...
> >>> Thanks Ken, so the mask is supported even on the inspector for Outlook
> >>> 2003? I know it works for the Explorer buttons.
> >>> Thanks
> >>>
> >>> Ken Slovak - [MVP - Outlook] wrote:
> >>>> Mask is supported for Outlook 2002 and later. It's only for
> Outlook 2000
> >>>> that you need to use a workaround. Are you needing to support Outlook
> >>>> 2000?
> >>>>
> >>>> The trick with Outlook 2000 is to use one color as a mask color, say
> >>>> magenta. That color can only be used where you want masking. Then
> you do
> >>>> some fancy stuff with the Win32 API and separate the mask and
> image and
> >>>> pop them onto the clipboard and use PasteFace to add the button image.
> >>>>
> >>>> See http://www.daveswebsite.com/articles/article1/default.shtml
> for a C++
> >>>> example and KB288771 for a VB example. Offhand I'm not familiar
> with any
> >>>> C# examples but there may be some out there if you Google for
> >>>> "PasteFace".
> >>>>
> >>
> >>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net