How to implement TRANSPARENT Bitmap Buttons 
Author Message
 How to implement TRANSPARENT Bitmap Buttons

In my application, some unshaped bitmap buttons are needed. Would someone
like to tell me how to implement a TRANSPARENT Bitmap Button!

Waiting for the reply anxious,

Paul



Thu, 05 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
hi Paul.

Quote:
>In my application, some unshaped bitmap buttons are needed. Would someone

theres a sample on www.codeguru.com.

WM_HOPETHISHELPS
thomas woelfer
http://www.woelfer.com



Thu, 05 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons

Quote:
>In my application, some unshaped bitmap buttons are needed. Would someone
>like to tell me how to implement a TRANSPARENT Bitmap Button!

Paul,

Have you considered using the BS_ICON style instead? Icons directly
support transparency and they're really easy to use.

Set the button style to "icon", and in the initialisation have a few
lines of code like this to set the icon on the button:

        HWND hUp;

        hUp = GetDlgItem( hDlg, IDC_UP );

        /* Assign the icon for the up button */
        HICON hU = LoadImage( g_hInstance, MAKEINTRESOURCE( IDI_UP ),
                        IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR );

        SendMessage( hUp, BM_SETIMAGE, IMAGE_ICON,
                        (LPARAM) (DWORD) hU );

Dave
----
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Fri, 06 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
Paul-

The answer is kind of long, but the short answer is that you create a bitmap
with a specific colored background. Then you can mask it onto the button.
Try looking at how MFC does it with toolbars.  Search for "toolbar
TBSTYLE_TRANSPARENT imagelist" in MSDN.

Good luck.
----------------------------------------------
Ric Wright
nCommand, Inc.
2121 Staunton Ct.
Palo Alto, CA
650-855-0600x113

---------------------------------------------

Quote:

>In my application, some unshaped bitmap buttons are needed. Would someone
>like to tell me how to implement a TRANSPARENT Bitmap Button!

>Waiting for the reply anxious,

>Paul



Fri, 06 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
Thanks for the solution, yes it works fine under NT. But Windows CE does
not support BS_ICON, and the image size of ICON is limited. Is there any
other way?

Best Regards,
----------------------------------------
Paul Shen
Software Engineer
Shanghai Kehwa Software Development Ltd.,
----------------------------------------

Quote:

> >In my application, some unshaped bitmap buttons are needed. Would someone
> >like to tell me how to implement a TRANSPARENT Bitmap Button!

> Paul,

> Have you considered using the BS_ICON style instead? Icons directly
> support transparency and they're really easy to use.

> Set the button style to "icon", and in the initialisation have a few
> lines of code like this to set the icon on the button:

>         HWND hUp;

>         hUp = GetDlgItem( hDlg, IDC_UP );

>         /* Assign the icon for the up button */
>         HICON hU = LoadImage( g_hInstance, MAKEINTRESOURCE( IDI_UP ),
>                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR );

>         SendMessage( hUp, BM_SETIMAGE, IMAGE_ICON,
>                         (LPARAM) (DWORD) hU );

> Dave
> ----
> My address is altered to discourage junk mail.
> Please post responses to the newsgroup thread,
> there's no need for follow-up email copies.



Sat, 07 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
You could always ownerdraw the button yourself... I've done this on CE, and
it works quite well.

Quote:

>Thanks for the solution, yes it works fine under NT. But Windows CE does
>not support BS_ICON, and the image size of ICON is limited. Is there any
>other way?

>Best Regards,
>----------------------------------------
>Paul Shen
>Software Engineer
>Shanghai Kehwa Software Development Ltd.,
>----------------------------------------


>> >In my application, some unshaped bitmap buttons are needed. Would
someone
>> >like to tell me how to implement a TRANSPARENT Bitmap Button!

>> Paul,

>> Have you considered using the BS_ICON style instead? Icons directly
>> support transparency and they're really easy to use.

>> Set the button style to "icon", and in the initialisation have a few
>> lines of code like this to set the icon on the button:

>>         HWND hUp;

>>         hUp = GetDlgItem( hDlg, IDC_UP );

>>         /* Assign the icon for the up button */
>>         HICON hU = LoadImage( g_hInstance, MAKEINTRESOURCE( IDI_UP ),
>>                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR );

>>         SendMessage( hUp, BM_SETIMAGE, IMAGE_ICON,
>>                         (LPARAM) (DWORD) hU );

>> Dave
>> ----
>> My address is altered to discourage junk mail.
>> Please post responses to the newsgroup thread,
>> there's no need for follow-up email copies.



Sat, 07 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons

Quote:
>Thanks for the solution, yes it works fine under NT. But Windows CE does
>not support BS_ICON, and the image size of ICON is limited. Is there any
>other way?

Paul,

Only more involved ones where you need to use bitmaps, there are
examples on MSDN if you search for "transparent NEAR bitmap".

Dave
----
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Sat, 07 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons


Fri, 19 Jun 1992 00:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
I use an owner-draw button, and then use DrawIconEx to draw the icon.

This is a case where CE is not lacking the feature, but rather offers only
one way to do it rather than two or three. (Another example would be the
absence of FrameRect, which is, after all, only a convenience function.
There are many others.)



Sun, 08 Jul 2001 03:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons


Fri, 19 Jun 1992 00:00:00 GMT  
 How to implement TRANSPARENT Bitmap Buttons
Paul,

Windows CE supports the following function:
    TransparentImage();     // Windows CE 2.0 and latter

which transfers a bitmap, omitting the portions drawn in a specified color.
You can use this function along with an Owner Draw button to get the results
that you desire.

I hope this helps!

Steven D'souza
Ruksun Software Technologies (INDIA)
http://www.ruksun.com/
http://www.ruksun.com/wince/
------

Quote:

>Thanks for the solution, yes it works fine under NT. But Windows CE does
>not support BS_ICON, and the image size of ICON is limited. Is there any
>other way?

>Best Regards,
>----------------------------------------
>Paul Shen
>Software Engineer
>Shanghai Kehwa Software Development Ltd.,
>----------------------------------------


>> >In my application, some unshaped bitmap buttons are needed. Would
someone
>> >like to tell me how to implement a TRANSPARENT Bitmap Button!

>> Paul,

>> Have you considered using the BS_ICON style instead? Icons directly
>> support transparency and they're really easy to use.

>> Set the button style to "icon", and in the initialisation have a few
>> lines of code like this to set the icon on the button:

>>         HWND hUp;

>>         hUp = GetDlgItem( hDlg, IDC_UP );

>>         /* Assign the icon for the up button */
>>         HICON hU = LoadImage( g_hInstance, MAKEINTRESOURCE( IDI_UP ),
>>                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR );

>>         SendMessage( hUp, BM_SETIMAGE, IMAGE_ICON,
>>                         (LPARAM) (DWORD) hU );

>> Dave
>> ----
>> My address is altered to discourage junk mail.
>> Please post responses to the newsgroup thread,
>> there's no need for follow-up email copies.



Mon, 09 Jul 2001 03:00:00 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. How to implement TRANSPARENT Bitmap Buttons

2. transparent bitmap on toolbar button

3. How to display Transparent Bitmap Button?

4. how to shape a button to a 24bit bitmap which delete the transparent region and

5. Transparent Bitmap Buttons

6. Transparent Bitmap buttons

7. Transparent Button Bitmap

8. Transparent Owner Drawn Bitmap Button

9. Transparent Bitmap Buttons ?

10. Disabling Bitmap Button loses bitmap

11. Bitmap buttons to behave like radio buttons?

12. transparent bitmap

 

 
Powered by phpBB® Forum Software