having a color show through another color
-
I have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color. I would like to blend these 2 colors to show that it is selected and show the original cell background color. when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines. Similar to how excel handles selection and background colors. thanks
-
I have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color. I would like to blend these 2 colors to show that it is selected and show the original cell background color. when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines. Similar to how excel handles selection and background colors. thanks
If it's just two values, blend them yourself. Or use GDI+, which has transparency, or AlphaBlt ( I think ), which is in Windows 98 upwards. Or go to the WDJ site and download the code for my article on doing alphablending for Windows 95. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
-
I have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color. I would like to blend these 2 colors to show that it is selected and show the original cell background color. when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines. Similar to how excel handles selection and background colors. thanks
Rblend = (R1 + R2) / 2 Gblend = (G1 + G2) / 2 Bblend = (B1 + B2) / 2 -c
Alcohol is the anesthesia by which we endure the operation of life. -- George Bernard Shaw
-
I have a grid that you can set a color for each cell. When multiple selection is on and i select cells with a background color in it the selection color over rides the original cell background color. I would like to blend these 2 colors to show that it is selected and show the original cell background color. when drawing i have the 2 COLORREF values. Is there a function to blend these or something along those lines. Similar to how excel handles selection and background colors. thanks
COLORREF CList::Transform2SelColor(COLORREF clr) { return RGB( abs( ((DWORD)clr&0xFF) - (255 - ((DWORD)m_clrSelection&0xFF)) ), abs( (((DWORD)clr>>8)&0xFF) - (255 -(((DWORD)m_clrSelection>>8)&0xFF)) ), abs( (((DWORD)clr>>16)&0xFF) - (255 - (((DWORD)m_clrSelection>>16)&0xFF)) )); } where clr is the slection color take the absolute value of (R value of the selection color - the inverse of the background color)