我用下面的代码无效,不显示或者根本就不调用class CBandZKCtrl : public CWindowImpl<CBandZKCtrl>
{
public: DECLARE_WND_SUPERCLASS(NULL, TEXT("STATIC")) BEGIN_MSG_MAP(CBandZKCtrl)
END_MSG_MAP()// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
CBandZKCtrl();
virtual ~CBandZKCtrl(); void DoPaint(CDCHandle dc)
{
static BOOL bLoad = FALSE;
static CBitmap m_Bitmap; if (!bLoad)
{
m_Bitmap.LoadBitmap(IDB_BITMAP_ZKBG);
bLoad = TRUE;
}
CSize m_sizeBmp; // bitmap's size
CPoint m_ptBmpLocation; // bitmap's location
COLORREF clrOld = 0;
RECT rcClient = { 0 };
GetClientRect(&rcClient);
CSize sizeImage(0);
CPoint ptLocation(0, 0);
// Get the bitmap's size
m_Bitmap.GetSize(sizeImage);
// Draw the image
dc.DrawState(ptLocation, sizeImage, m_Bitmap.m_hBitmap, DST_BITMAP);
}
};
{
public: DECLARE_WND_SUPERCLASS(NULL, TEXT("STATIC")) BEGIN_MSG_MAP(CBandZKCtrl)
END_MSG_MAP()// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
CBandZKCtrl();
virtual ~CBandZKCtrl(); void DoPaint(CDCHandle dc)
{
static BOOL bLoad = FALSE;
static CBitmap m_Bitmap; if (!bLoad)
{
m_Bitmap.LoadBitmap(IDB_BITMAP_ZKBG);
bLoad = TRUE;
}
CSize m_sizeBmp; // bitmap's size
CPoint m_ptBmpLocation; // bitmap's location
COLORREF clrOld = 0;
RECT rcClient = { 0 };
GetClientRect(&rcClient);
CSize sizeImage(0);
CPoint ptLocation(0, 0);
// Get the bitmap's size
m_Bitmap.GetSize(sizeImage);
// Draw the image
dc.DrawState(ptLocation, sizeImage, m_Bitmap.m_hBitmap, DST_BITMAP);
}
};
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货