CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2000
    Posts
    305

    Transparent bmps in buttons

    Hey

    I'm trying to put 2 buttons in a dialog of mine, one having the small disk meaning save, and the other the small printer, which means, of course, print.

    My first aproach was to see if these were OEM resources. They aren't as far as i know.

    After that i created 2 resources in my project (one for each bmp), and then using CButton::SetBitmap(), I attached them to the buttons. The problem is that the bmps are not transparent, or in other words, if a user changes the colour scheme in windows, an ugly grey square will be visible in my buttons.
    Is there any way to make these bmps transparent or solving my problem in any other way ?

    Thanks in advance

    __________________________________________________________
    You can contact me at esanto@yahoo.com

  2. #2
    Join Date
    Sep 2001
    Posts
    512

    Re: Transparent bmps in buttons

    I did this using owner drawn buttons. Another option is to create icons from the bitmaps and use these but you don't get text on the button as well as the icon.

    Hope this helps
    Hope this helps

  3. #3
    Join Date
    Jun 2000
    Posts
    305

    Re: Transparent bmps in buttons

    I don't need to put text, so i think i'll use icons.

    Do you know any good program to create icons, given a bmp ?



    __________________________________________________________
    You can contact me at esanto@yahoo.com

  4. #4
    Join Date
    Sep 2001
    Posts
    512

    Re: Transparent bmps in buttons

    You can use an image list to create icons from bitmaps by the following method


    HIMAGELIST hIml = ImageList_LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_YOURBITMAP), 16, 1, RGB(128, 128, 128));
    // Where the rgb is the colour you wish to be transparent.
    // 16 is the size and 1 is the number of images to grow by
    HICON hIcon = ImageList_GetIcon(hIml, 0, ILD_NORMAL);





    Hope this helps
    Hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured