void CdrawbuttonDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: 在此添加消息处理程序代码和/或调用默认值 CDC dcbutton,dcbitmap; CRect rc; CBitmap tbitmap; BITMAP bm; dcbutton.Attach(lpDrawItemStruct->hDC); rc=lpDrawItemStruct->rcItem; dcbitmap.CreateCompatibleDC(&dcbutton); tbitmap.LoadBitmapW(IDB_BITMAP2); tbitmap.GetBitmap(&bm); dcbitmap.SelectObject(&tbitmap); dcbutton.StretchBlt(rc.left,rc.top,rc.right,rc.bottom,&dcbitmap,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY); tbitmap.DeleteObject(); CDialogEx::OnDrawItem(nIDCtl, lpDrawItemStruct); }