Getting transparent icons out of CImageList ?
-
Hello, I'm trying to draw a toolbar with icons designed by myself(which I'm very proud of them:)). I use CImageList to store my icons then I pass my ImageList to CToolBar to do the rest of work. I did not use LoadToolBar because I wanted to have greater control over buttons and their associated pictures. How should I tell to CImageList to get its hand off my icon and do not place a black background behind them. I want background of my icons be color of my framework. This is my code...
m_ImageList.SetBkColor(CLR_NONE); //even when I omit this line the result is the same m_ImageList.Add(LoadIcon(hIcon)); ... m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD |WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_ToolBar.GetToolBarCtrl().SetImageList(&m_ImageList); ...
thanks:) -
Hello, I'm trying to draw a toolbar with icons designed by myself(which I'm very proud of them:)). I use CImageList to store my icons then I pass my ImageList to CToolBar to do the rest of work. I did not use LoadToolBar because I wanted to have greater control over buttons and their associated pictures. How should I tell to CImageList to get its hand off my icon and do not place a black background behind them. I want background of my icons be color of my framework. This is my code...
m_ImageList.SetBkColor(CLR_NONE); //even when I omit this line the result is the same m_ImageList.Add(LoadIcon(hIcon)); ... m_ToolBar.CreateEx(this, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT, WS_CHILD |WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); m_ToolBar.GetToolBarCtrl().SetImageList(&m_ImageList); ...
thanks:)You didn't show how you are creating the image list. It needs to be masked... // assuming icons are 16x16 m_ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1); ... m_ImageList.Add(LoadIcon(hIcon));
"Go that way, really fast. If something gets in your way, turn."
-
You didn't show how you are creating the image list. It needs to be masked... // assuming icons are 16x16 m_ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1); ... m_ImageList.Add(LoadIcon(hIcon));
"Go that way, really fast. If something gets in your way, turn."
Thanks a lot mark, you helped me again:). and you solved my problem completely! I was wondering what is your mean from the phrase in your signature
Mark Salsbery wrote:
"Go that way, really fast. If something gets in your way, turn."
Dose it mean one should find the way by trail and error :confused: anyway thanks for all the helps:):rose:
-
Thanks a lot mark, you helped me again:). and you solved my problem completely! I was wondering what is your mean from the phrase in your signature
Mark Salsbery wrote:
"Go that way, really fast. If something gets in your way, turn."
Dose it mean one should find the way by trail and error :confused: anyway thanks for all the helps:):rose:
Electronic75 wrote:
I was wondering what is your mean from the phrase in your signature
That's a quote from the move "Better Off Dead". Those are skiing instructions ;P (they work for extreme programming as well :))
"Go that way, really fast. If something gets in your way, turn."