Adding these two line to the init dialog also doesnt show the picture???? m_opaque.ModifyStyle(0, WS_CHILD|WS_VISIBLE|BS_BITMAP); m_opaque.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) );
safigh
Posts
-
Displaying Bitmap on a button [modified] -
Displaying Bitmap on a button [modified]Hi all. I am using MFC, and I want to display a bitmap on a button. I created the resource and it appeared in the bitmap resources as IDB_BITMAP1. Now I added a button named m_opaque and added the followin code to the OnPaint function:
void HelloDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); m_opaque.ModifyStyle(0, WS_CHILD|WS_VISIBLE|BS_BITMAP); m_opaque.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) ); // UpdateData(FALSE); } else { CDialog::OnPaint(); } }
The code compiles but the image doesnt appear. what is the reason? -- modified at 11:27 Tuesday 11th July, 2006 -
From .exe to .libDont take the "BIG" word to that extent. It is big in core not in interface. I'll check the links and go back to u soon. Thanks anyway.
-
From .exe to .libI can't get you. This is complicated for me. I am a beginner. Can you explain in more details and easier steps?
-
From .exe to .libDavidCrow wrote:
Create a temporary DLL project and make a note of what linker options are used. Incorporate those into X.
Do you mean that I should creat a DLL project that link to these libraries and then put this DLL in X, thus X is linked to the libraries? How to create this DLL project and how to link it to X?
-
From .exe to .libHello all, I have a working BIG MFC project X. Now I want to create a new project Y(or another interface) that will use the older MFC project X as a library from which classes and methods are called. I changed the general properties of the X from .exe to .lib and Linked Y to X in the linker properties. The problem is that I lost all linker options that were in X (I used to link X to other libraries). Whatis the solution for this? Thank you very much. Regards