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
and heres part of the toolbar classCode: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 );
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 ); }



LinkBack URL
About LinkBacks


