當前位置:編程學習大全網 - 網站源碼 - MFC 多文檔如何更改主框體體的背景,把灰色的背景改為圖片?

MFC 多文檔如何更改主框體體的背景,把灰色的背景改為圖片?

1.選擇壹張.bmp的圖片導入到Bitmap中,然後添加以下代碼

在.h中定義畫刷

CBrush m_brBk;

BOOL CUsrLogin::OnInitDialog()

{

CDialog::OnInitDialog();

CBitmap bmp;

bmp.LoadBitmap(IDB_BITMAP1);

m_brBk.CreatePatternBrush(&bmp);

bmp.DeleteObject();

return TRUE; // return TRUE unless you set the focus to a control

// EXCEPTION: OCX Property Pages should return FALSE

}

HBRUSH CUsrLogin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)

{

HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

if (pWnd == this)

{

return m_brBk;

}

return hbr;

}

  • 上一篇:2019福州羅源縣林業局招聘護林員招聘步驟有哪些?
  • 下一篇:網絡考試源代碼,看這個能找到答案嗎?
  • copyright 2024編程學習大全網