Bitmap/Icon Toolbar Problem

This is a discussion on Bitmap/Icon Toolbar Problem within the Windows Programming forums, part of the Platform Specific Boards category; recently i finished a simple text editor, i never noticed this problem until someone i gave this app told me ...

  1. #1
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204

    Bitmap/Icon Toolbar Problem

    recently i finished a simple text editor, i never noticed this problem until someone i gave this app told me the the toolbar buttons dont look right when disbaled.. then i realized the buttons bitmaps and icons tend to change its background color to white on classic Theme of windows.. i dont know whts the problem here any1 encountered this kind of problem yet?

    heres the screenshots..


    Enabled Toolbar Buttons
    http://img134.exs.cx/my.php?loc=img1...toolbar4hs.jpg

    Disabled
    http://img134.exs.cx/my.php?loc=img1...toolbar4gv.jpg

    heres my imagelist class
    Code:
        void IMAGELIST::create(HWND parentWnd)
        {
            hwnd=parentWnd;
            imagelist=ImageList_Create( 16,16, ILC_COLOR8|ILC_MASK, 3,0 );
        }
    
        void IMAGELIST::insertIcon(LPCTSTR icon)
        {
            HICON hicon=LoadIcon( (HINSTANCE)GetWindowLong( hwnd, GWL_HINSTANCE ), icon );
            ImageList_AddIcon( imagelist, hicon );
            DestroyIcon( hicon );
        }
    
        void IMAGELIST::insertBitmap(LPCTSTR bitmap)
        {
            HBITMAP hbitmap=LoadBitmap( (HINSTANCE)GetWindowLong( hwnd, GWL_HINSTANCE ), bitmap );
            ImageList_AddMasked( imagelist,hbitmap,RGB( 0, 0, 255 ) );
            DeleteObject( hbitmap );
    and heres part of the toolbar class

    Code:
        void TOOLBAR::setImageList(HIMAGELIST imgl)
        {
    
            SendMessage( hwnd, TB_SETIMAGELIST, 0, (LPARAM)imgl );
    
        }
    
        void TOOLBAR::insertButton(char *name, int image, int resourceID, int state )
        {
            TBBUTTON ptb;
            DWORD style = ( TBSTYLE_FLAT | TBSTYLE_TOOLTIPS );
    
            if( resourceID == m_new )
                style = ( TBSTYLE_TOOLTIPS | TBSTYLE_DROPDOWN );
    
            ptb.dwData        = 0;
            ptb.fsState        = state; 
            ptb.fsStyle        = (unsigned char)style;
            ptb.iBitmap        = image;
            ptb.idCommand    = resourceID;
            SendMessage( hwnd, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&ptb );
    
    
        }
    
        void TOOLBAR::setExtendedStyle( DWORD style )
        {
            SendMessage( hwnd, TB_SETEXTENDEDSTYLE, 0, style );
        }
    
        void TOOLBAR::insertSeparator()
        {
            TBBUTTON ptb;
            ptb.fsState        = 0;
            ptb.fsStyle        = TBSTYLE_SEP;
    
            SendMessage( hwnd, TB_ADDBUTTONS, (WPARAM)1, (LPARAM)&ptb );
        }
    Last edited by loko; 02-07-2005 at 01:20 PM.

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Try ILC_COLOR32, ie.
    Code:
    void IMAGELIST::create(HWND parentWnd)
      {
        hwnd=parentWnd;
        imagelist=ImageList_Create( 16,16, ILC_COLOR32|ILC_MASK, 3,0 );
      }
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    Quote Originally Posted by Ken Fitlike
    Try ILC_COLOR32, ie.
    Code:
    void IMAGELIST::create(HWND parentWnd)
      {
        hwnd=parentWnd;
        imagelist=ImageList_Create( 16,16, ILC_COLOR32|ILC_MASK, 3,0 );
      }
    dint work

  4. #4
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    works fine now, problem has been the lParam value i was passing with sendmessage to disable the button from 1 I changed it to 0

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Toolbar problem
    By mrafcho001 in forum Windows Programming
    Replies: 2
    Last Post: 12-27-2005, 11:38 AM
  3. Toolbar problem
    By Ward in forum Windows Programming
    Replies: 0
    Last Post: 12-21-2005, 03:08 PM
  4. Dockable Toolbar (Like taskbar or office toolbar)
    By om3ga in forum Windows Programming
    Replies: 2
    Last Post: 11-20-2005, 03:09 AM
  5. Troubles with ListView and Toolbar
    By cornholio in forum Windows Programming
    Replies: 8
    Last Post: 11-14-2005, 01:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21