|
-
November 16th, 2007, 09:54 AM
#1
Assertion failure in load/setbitmap()
In my application (VS 2003) I want to display a bitmap in a picture control. I want to change the bitmap depending on what color mode the user has chosen. I've attached a CStatic variable to the picture control, but calling the SetBitmap raises an assertion failure. Initially the assertion was raised when I called the LoadBitmap on a member variable CBitmap, but changing to a local variable "solved" the problem. What am I missing? All help greatly appreciated.
DDX_Control(pDX, IDC_PICCTRL, m_oPicCtrl);
HBRUSH CMyClass:OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CGuiBase::OnCtlColor(pDC, pWnd, nCtlColor);
// Set brush to desired background color
CPalette * pPalette = (CPalette*)GetPalette();
CBitmap bmp;
int lightMode = m_iCurrentLightMode;
GetLightMode(&lightMode, -1);
if(lightMode != m_iCurrentLightMode || m_iCurrentLightMode < 0)
{
try
{
if(lightMode==BRIGHT_DAYLIGHT_DISP||lightMode==WHITE_DAY_LIGHT_DISP) //0
{
m_iCurrentLightMode = lightMode; bmp.LoadBitmap(IDB_BITMAP1);
}
else
{
m_iCurrentLightMode = lightMode;
bmp.LoadBitmap(IDB_BITMAP");
}
m_oPicCtrl.SetBitmap(bmp)
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|