mjwilliamson
asked on
CStatic
Hi i am trying to display a bitmap image on
a dialog using a static control. I have placed the
control on the dialog using the picture control, in
the properties it comes up as IDC_STATIC so i'm pressuming
so far so good?
When I go to the Class wizard i cannot see it, should
i be able to?
I have a bitmap resource named IDB_BITMAP1
i then have the following code in the OnInitDialog
CStatic pic;
pic.Create(_T("Hello"),WS_ CHILD|WS_V ISIBLE|SS_ BITMAP, CRect (10,10,150,200), this, IDC_STATIC);
pic.SetBitmap(::LoadBitmap (AfxGetApp ()->m_hIns tance, MAKEINTRESOURCE(IDB_BITMAP 1)));
basically it no working :-(
Any help appreciated.
(p.s. i cant believe is so difficult to display
an image in a dialog - but i am new to C++ and MFC)
a dialog using a static control. I have placed the
control on the dialog using the picture control, in
the properties it comes up as IDC_STATIC so i'm pressuming
so far so good?
When I go to the Class wizard i cannot see it, should
i be able to?
I have a bitmap resource named IDB_BITMAP1
i then have the following code in the OnInitDialog
CStatic pic;
pic.Create(_T("Hello"),WS_
pic.SetBitmap(::LoadBitmap
basically it no working :-(
Any help appreciated.
(p.s. i cant believe is so difficult to display
an image in a dialog - but i am new to C++ and MFC)
ASKER
As you can see i've tried a couple of methods
neither work.
Someone must be able to answer this question. Surely!
neither work.
Someone must be able to answer this question. Surely!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was using
CDialog(IDD_EXL_CHART).DoM odal();
instead of
CExcel dlg;
dlg.DoModal();
when showing the Dialog
arrrrgh
I'll give you points seen as you answered!
CDialog(IDD_EXL_CHART).DoM
instead of
CExcel dlg;
dlg.DoModal();
when showing the Dialog
arrrrgh
I'll give you points seen as you answered!
ASKER
Can't believe it!
Thanks :)
ASKER
add Static control that CW would recognise.
New Dialog, new Static control
IDC_STATIC_BMP
Control Type is Bitmap
In class wizard
IDC_STATIC_BMP maps to CStatic member variable
m_pic
I also have CBitmap variable m_bitmap
in dialog class.
If I set the image property and run app then
image is displayed. If I try to do it at runtime
I get nothing at all.
Code I'm using is below
BOOL CExlDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//
m_bitmap.LoadBitmap(IDB_BI
//m_pic.Create(_T("Hello")
//m_pic.SetBitmap(::LoadBi
HBITMAP hBitmap;
hBitmap = m_bitmap;
m_pic.SetBitmap(hBitmap);
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HEEEEEEEEEEEEEELLP!
Thanks