//处理图片 bool CRichEditMessage::LoadRichEditImage(HINSTANCE hInstance, UINT uResourceID, CDataObject&ImageDataObject) { //加载图片 CBitImage ImageFile; ImageFile.LoadFromResource(hInstance,uResourceID); //失败判断 if (ImageFile.IsNull()==true) { ASSERT(FALSE); return false; } //创建表情 CImage ImageRichEdit; ImageRichEdit.Create(ImageFile.GetWidth(),ImageFile.GetHeight(),32); //绘画表情 CDC * pDC=CDC::FromHandle(ImageRichEdit.GetDC()); pDC->FillSolidRect(0,0,ImageFile.GetWidth(),ImageFile.GetHeight(),m_crFillColor); ImageFile.TransDrawImage(pDC,0,0,RGB(255,0,255)); //设置图片 ImageRichEdit.ReleaseDC(); ImageDataObject.SetImage(ImageRichEdit.Detach()); return true; }
//绘画函数 VOID CDlgRegWizardUserInfo::OnPaint() { CPaintDC dc(this); //绘画背景 CRect rcClient; GetClientRect(&rcClient); //绘画位图 CBitImage ImageBreviaryMap; ImageBreviaryMap.LoadFromResource(AfxGetInstanceHandle(),IDB_BREVIARY_MAP); ImageBreviaryMap.TransDrawImage(&dc,rcClient.Width()-ImageBreviaryMap.GetWidth()-15,35,RGB(255,0,255)); return; }
//绘画处理 bool CFrameEncircle::PreDrawEncircleImage(tagEncircleBMP & EncircleImage) { //加载图标 CBitImage ImageLogo; ImageLogo.LoadFromResource(AfxGetInstanceHandle(),TEXT("GAME_LOGO")); //绘画图标 if (ImageLogo.IsNull()==false) { //变量定义 CDC * pDC=CDC::FromHandle(EncircleImage.ImageTL.GetDC()); //绘画图标 ImageLogo.TransDrawImage(pDC,10,8,RGB(255,0,255)); //释放资源 EncircleImage.ImageTL.ReleaseDC(); } return true; }