A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Transparent Inspector images



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 15th 06, 04:11 PM posted to microsoft.public.outlook.program_addins
Rog
external usenet poster
 
Posts: 62
Default Transparent Inspector images

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
Ads
  #2  
Old March 15th 06, 04:29 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Transparent Inspector images

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.../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" wrote in message
...
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


  #3  
Old March 15th 06, 04:41 PM posted to microsoft.public.outlook.program_addins
Rog
external usenet poster
 
Posts: 62
Default Transparent Inspector images

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.../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".

  #4  
Old March 15th 06, 07:57 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Transparent Inspector images

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" wrote in message
...
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.../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".



  #5  
Old March 15th 06, 09:51 PM posted to microsoft.public.outlook.program_addins
Rog
external usenet poster
 
Posts: 62
Default Transparent Inspector images

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" wrote in message
...
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.../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".



  #6  
Old March 15th 06, 10:26 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Transparent Inspector images

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" wrote in message
...
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" wrote in message
...
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.../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".



  #7  
Old March 15th 06, 10:45 PM posted to microsoft.public.outlook.program_addins
Dave Kane [MVP - Outlook]
external usenet poster
 
Posts: 33
Default Transparent Inspector images

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(bmpIm age, False)

'PasteFace copies image to our button

cbb.PasteFace()

'restore original data to clipboard

System.Windows.Forms.Clipboard.SetDataObject(saved Data)

Catch ex As Exception

'exception handling here

End Try

End Sub


"Rog" wrote in message ...
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" wrote in message
...
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.../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".



  #8  
Old March 15th 06, 10:52 PM posted to microsoft.public.outlook.program_addins
Rog
external usenet poster
 
Posts: 62
Default Transparent Inspector images

Thanks everyone, I will let you know what I end up doing.


Dave Kane [MVP - Outlook] wrote:
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(bmpIm age, False)

'PasteFace copies image to our button

cbb.PasteFace()

'restore original data to clipboard

System.Windows.Forms.Clipboard.SetDataObject(saved Data)

Catch ex As Exception

'exception handling here

End Try

End Sub


"Rog" wrote in message
...
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" wrote in message
...
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.../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".



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Right Click on Inspector Window header jim Add-ins for Outlook 1 February 18th 06 12:09 AM
Inspector Wrapper utlook 2000 jim Add-ins for Outlook 5 February 17th 06 11:12 PM
Help! Inspector.Close is fired before Inspector.Activate handler finishes Sergey Anchipolevsky Add-ins for Outlook 8 February 9th 06 10:51 AM
how to add commandbarbutton to inspector window Ram Outlook and VBA 0 January 19th 06 07:07 AM
how to add commandbarbutton to inspector window Ram Outlook - General Queries 1 January 18th 06 09:42 PM


All times are GMT +1. The time now is 02:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.