Click here to Skip to main content
16,006,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to read parameter from stored procedure ? Pin
Bartek26-Jul-01 2:09
Bartek26-Jul-01 2:09 
GeneralWANTED: Clever Ideas Pin
Derek Lakin26-Jul-01 1:59
Derek Lakin26-Jul-01 1:59 
GeneralRe: WANTED: Clever Ideas Pin
Tomasz Sowinski26-Jul-01 3:01
Tomasz Sowinski26-Jul-01 3:01 
GeneralRe: ON_UPDATE_COMMAND_UI Pin
Derek Lakin26-Jul-01 5:20
Derek Lakin26-Jul-01 5:20 
GeneralRe: ON_UPDATE_COMMAND_UI Pin
George Chastain26-Jul-01 5:34
George Chastain26-Jul-01 5:34 
GeneralRe: WM_KICKIDLE Pin
Derek Lakin26-Jul-01 21:15
Derek Lakin26-Jul-01 21:15 
GeneralRe: ON_UPDATE_COMMAND_UI Pin
Tomasz Sowinski26-Jul-01 6:41
Tomasz Sowinski26-Jul-01 6:41 
GeneralDrawing Icons on Buttons Pin
Derek Lakin26-Jul-01 1:54
Derek Lakin26-Jul-01 1:54 
The next episode in my ongoing saga of owner drawn buttons:

I want to allow icons or bitmaps to be drawn on my button and this can be done using a CImageList to store the images in. At the moment I just have a single icon or bitmap to draw (the rest will come later) and I'm using the following to draw the image in DrawItem:
void CButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {
	// ...
	m_imageList.DrawIndirect (pDC, 0, CPoint(3 + m_bBtnPushed, 3 + m_bBtnPushed),
		CSize (m_nImageWidth, m_nImageHeight), CPoint (0, 0), ILD_NORMAL);
	// ...
}


The problem is that the transparent bits of an icon are drawn black! Any ideas why?

The icon is added to the image list as follows:
BOOL CButtonEx::SetButtonIcon(UINT nResourceID, COLORREF crMask) {
	BOOL bReturn = FALSE;
	HINSTANCE hInstance = AfxFindResourceHandle (MAKEINTRESOURCE (nResourceID), RT_GROUP_ICON);

	m_hIcon = (HICON)::LoadImage (hInstance, MAKEINTRESOURCE (nResourceID), IMAGE_ICON, 0, 0, 0);
	if (NULL != m_hIcon) {
		m_crMask = crMask;
		ICONINFO iconInfo;
		ZeroMemory (&iconInfo, sizeof (ICONINFO));
		bReturn = ::GetIconInfo (m_hIcon, &iconInfo);
		if (TRUE == bReturn) {
			m_nImageWidth = iconInfo.xHotspot * 2;
			m_nImageHeight = iconInfo.yHotspot * 2;
			::DeleteObject(iconInfo.hbmMask);
			::DeleteObject(iconInfo.hbmColor);
			bReturn = m_imageList.Create (m_nImageWidth, m_nImageHeight, ILC_COLOR32, 1, 1);
			if (TRUE == bReturn) {
				if (m_imageList.Add (m_hIcon) > -1) {
					m_bImageLoaded = TRUE;
				}
				else {
					m_bImageLoaded = FALSE;
				}
			}
		}
	}

	return bReturn;
}

GeneralRe: Drawing Icons on Buttons Pin
Steve Thresher26-Jul-01 5:51
Steve Thresher26-Jul-01 5:51 
GeneralRe: ILC_MASK Pin
Derek Lakin26-Jul-01 21:16
Derek Lakin26-Jul-01 21:16 
GeneralDialog design Pin
26-Jul-01 1:44
suss26-Jul-01 1:44 
QuestionWhat is type: something** ? Pin
26-Jul-01 1:44
suss26-Jul-01 1:44 
AnswerRe: What is type: something** ? Pin
Derek Lakin26-Jul-01 1:47
Derek Lakin26-Jul-01 1:47 
GeneralRe: What is type: something** ? Pin
Derek Waters26-Jul-01 16:50
Derek Waters26-Jul-01 16:50 
GeneralRe: What is type: something** ? Pin
Sam C26-Jul-01 17:34
Sam C26-Jul-01 17:34 
GeneralRe: What is type: something** ? Pin
Derek Waters26-Jul-01 18:30
Derek Waters26-Jul-01 18:30 
GeneralRe: What is type: something** ? Pin
Sam C26-Jul-01 19:42
Sam C26-Jul-01 19:42 
QuestionSQL ? Pin
otvac26-Jul-01 1:39
otvac26-Jul-01 1:39 
AnswerRe: SQL ? Pin
Matt Gullett26-Jul-01 2:09
Matt Gullett26-Jul-01 2:09 
AnswerRe: SQL ? Pin
Hadi Rezaee27-Jul-01 18:18
Hadi Rezaee27-Jul-01 18:18 
GeneralRe: SQL ? Pin
Jamie Nordmeyer27-Jul-01 20:22
Jamie Nordmeyer27-Jul-01 20:22 
GeneralRe: SQL ? Pin
Hadi Rezaee27-Jul-01 20:45
Hadi Rezaee27-Jul-01 20:45 
GeneralRe: SQL ? Pin
Jamie Nordmeyer27-Jul-01 22:36
Jamie Nordmeyer27-Jul-01 22:36 
GeneralRe: SQL ? Pin
Hadi Rezaee28-Jul-01 18:58
Hadi Rezaee28-Jul-01 18:58 
Generallogging winsock send/receive Pin
Kuniva26-Jul-01 0:30
Kuniva26-Jul-01 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.