Click here to Skip to main content
15,885,772 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralKeyboard Hooking Pin
Adeel68822-Jul-05 21:01
Adeel68822-Jul-05 21:01 
GeneralRe: Keyboard Hooking Pin
Alexander M.,24-Jul-05 3:23
Alexander M.,24-Jul-05 3:23 
QuestionHow to set a menu bar into a dialog with child style? Pin
DaveLand22-Jul-05 20:39
DaveLand22-Jul-05 20:39 
GeneralScreen Capture Pin
dSolariuM22-Jul-05 19:20
dSolariuM22-Jul-05 19:20 
GeneralRe: Screen Capture Pin
fakefur22-Jul-05 19:55
fakefur22-Jul-05 19:55 
GeneralRe: Screen Capture Pin
sunit522-Jul-05 20:54
sunit522-Jul-05 20:54 
GeneralRe-Associate WebPage with WebSite Pin
CodingBadger22-Jul-05 17:55
CodingBadger22-Jul-05 17:55 
GeneralPrinting bitmaps to printer Pin
Santanu Lahiri22-Jul-05 11:23
Santanu Lahiri22-Jul-05 11:23 
I have a series of small bitmaps I need to print. The bitmaps are approx. 20 pixels wide and 15 pixels high. I would like them to print on the printer at about 1/4" or so high and 3/4" wide. I figured I could use the StretchBlt call to do this. I am using the following code:

// nTxtHt holds the height of a line of text to be printed
CBitmap bmp;
bmp.LoadBitmap (nBmpID);

BITMAP bm;
bmp.GetBitmap (&bm);

int nWd = bm.bmWidth;
int nHt = bm.bmHeight;
int nWide = MulDiv (nWd, nTxtHt, nHt);

CDC memDC;
memDC.CreateCompatibleDC (pDC);
CBitmap *pBmpOld = memDC.SelectObject (&bmp);

CRect rc (CPoint (nX, nY), CSize (nWide, nTxtHt));
pDC->Rectangle (&rc);
pDC->StretchBlt(nX, nY, nWide, nTxtHt, &memDC, 0, 0, nWd, nHt, SRCCOPY);
memDC.SelectObject(pBmpOld);


The framing rectangle prints just fine. The bitmap prints fine in preview. But when printed to printer, it shows up as a dot.

What am I doing wrong here?
GeneralRe: Printing bitmaps to printer Pin
Christian Graus22-Jul-05 12:14
protectorChristian Graus22-Jul-05 12:14 
GeneralWriting Data to an Open File Pin
Freddie Code22-Jul-05 11:05
Freddie Code22-Jul-05 11:05 
GeneralRe: Writing Data to an Open File Pin
David Crow22-Jul-05 17:52
David Crow22-Jul-05 17:52 
Generalregistry values Pin
Deian22-Jul-05 10:09
Deian22-Jul-05 10:09 
GeneralRe: registry values Pin
David Crow22-Jul-05 10:29
David Crow22-Jul-05 10:29 
GeneralRe: registry values Pin
Deian22-Jul-05 11:15
Deian22-Jul-05 11:15 
GeneralRe: registry values Pin
David Crow22-Jul-05 17:49
David Crow22-Jul-05 17:49 
GeneralRe: registry values Pin
Deian22-Jul-05 22:26
Deian22-Jul-05 22:26 
GeneralRe: registry values Pin
David Crow24-Jul-05 15:56
David Crow24-Jul-05 15:56 
GeneralDetect Mouse Click Pin
jedd99922-Jul-05 10:01
jedd99922-Jul-05 10:01 
GeneralRe: Detect Mouse Click Pin
David Crow22-Jul-05 10:28
David Crow22-Jul-05 10:28 
GeneralVisual C++ 5.0 and Chinese Font Pin
mshuster22-Jul-05 8:54
mshuster22-Jul-05 8:54 
GeneralRe: how to create window in mfc Pin
krmed22-Jul-05 8:20
krmed22-Jul-05 8:20 
GeneralOpenFileDialog in a custom control Pin
Fco. Javier Marin22-Jul-05 7:37
Fco. Javier Marin22-Jul-05 7:37 
Generalkill .exe from an mfc appl Pin
chenggong22-Jul-05 7:36
chenggong22-Jul-05 7:36 
GeneralRe: kill .exe from an mfc appl Pin
David Crow22-Jul-05 8:23
David Crow22-Jul-05 8:23 
GeneralRich edit... help me Pin
Aqueel22-Jul-05 7:26
Aqueel22-Jul-05 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.