Click to See Complete Forum and Search --> : Windows Forms - Print bitmap stored in resources


bowebay
January 25th, 2009, 12:59 PM
I'm a beginner with Windows Forms and am attempting to re-implement an application developed in MFC.

In the MFC implementation I had a bitmap in the bitmap resources of the project as (IDB_RDBSIG1). I was able to access and print the bitmap with the following code.

CBitmap bmpSig;
bmpSig.LoadBitmap(IDB_RDBSIG1);
BITMAP bm;
bmpSig.GetObject(sizeof(BITMAP), &bm);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap* pbmpOld = dcMem.SelectObject(&bmpSig);

pt.x = 20;
pt.y = 30;
pDC->BitBlt(pt.x,pt.y,bm.bmWidth,bm.bmHeight,&dcMem,0,0,SRCCOPY);
dcMem.SelectObject(pbmpOld);


I have been unable to find or generate an equivalent implementation for Windows Forms. Any help or guidance would be greatly appreciated.

cilu
January 26th, 2009, 03:34 AM
[ redirected ]