Click here to Skip to main content
15,914,820 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionBitBlt does not work in print preview Pin
theCPkid18-Sep-08 5:29
theCPkid18-Sep-08 5:29 
AnswerRe: BitBlt does not work in print preview Pin
Mark Salsbery18-Sep-08 5:49
Mark Salsbery18-Sep-08 5:49 
GeneralRe: BitBlt does not work in print preview Pin
theCPkid18-Sep-08 5:54
theCPkid18-Sep-08 5:54 
QuestionRe: BitBlt does not work in print preview Pin
Mark Salsbery18-Sep-08 5:57
Mark Salsbery18-Sep-08 5:57 
AnswerRe: BitBlt does not work in print preview Pin
theCPkid18-Sep-08 6:03
theCPkid18-Sep-08 6:03 
GeneralRe: BitBlt does not work in print preview Pin
Mark Salsbery18-Sep-08 6:34
Mark Salsbery18-Sep-08 6:34 
GeneralRe: BitBlt does not work in print preview [modified] Pin
theCPkid18-Sep-08 7:01
theCPkid18-Sep-08 7:01 
GeneralRe: BitBlt does not work in print preview Pin
Mark Salsbery18-Sep-08 7:25
Mark Salsbery18-Sep-08 7:25 
Creating that big bitmap on every draw is going to be a little slow.
I would only (re)create it when the size changes.


theCPkid wrote:
(CONST BITMAPINFO*)&BMIH


Bad cast!!!!! No bueno! You need to pass a pointer to a BITMAPINFO,
not a pointer to a BITMAPINFOHEADER. The cast just hides the error from
the compiler Smile | :)

Try
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(BITMAPINFO));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = rcClient.Width();
bmi.bmiHeader.biHeight = rcClient.Height();
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
bmi.bmiHeader.biSizeImage = ((((bmi.bmiHeader.biWidth * bmi.bmiHeader.biBitCount) + 31) & ~31) >> 3) * bmi.bmiHeader.biHeight;
//bmi.bmiHeader.biXPelsPerMeter = 0;
//bmi.bmiHeader.biYPelsPerMeter = 0;
//bmi.bmiHeader.biClrUsed = 0;
//bmi.bmiHeader.biClrImportant = 0;

bmp = ::CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**)&drawingSurfaceBits, NULL, 0);

I'm not sure what's going on with the rendering quality....I'll ponder that
and let you know if I think of something...(maybe the code fix above will do better?)

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: BitBlt does not work in print preview Pin
theCPkid18-Sep-08 22:44
theCPkid18-Sep-08 22:44 
GeneralRe: BitBlt does not work in print preview Pin
Mark Salsbery19-Sep-08 5:17
Mark Salsbery19-Sep-08 5:17 
GeneralRe: BitBlt does not work in print preview Pin
theCPkid19-Sep-08 19:49
theCPkid19-Sep-08 19:49 
AnswerRe: BitBlt does not work in print preview Pin
Roger Allen18-Sep-08 14:37
Roger Allen18-Sep-08 14:37 
GeneralRe: BitBlt does not work in print preview Pin
theCPkid18-Sep-08 22:42
theCPkid18-Sep-08 22:42 
QuestionHow can i lock the internet from a C++ program Pin
SNArruda18-Sep-08 5:04
SNArruda18-Sep-08 5:04 
AnswerRe: How can i lock the internet from a C++ program Pin
David Crow18-Sep-08 5:21
David Crow18-Sep-08 5:21 
JokeRe: How can i lock the internet from a C++ program Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:22
Iain Clarke, Warrior Programmer18-Sep-08 5:22 
AnswerRe: How can i lock the internet from a C++ program Pin
Bram van Kampen18-Sep-08 14:55
Bram van Kampen18-Sep-08 14:55 
QuestionRatio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:01
simon alec smith18-Sep-08 5:01 
QuestionRe: Ratio result placing a square not working - when resizing window Pin
David Crow18-Sep-08 5:26
David Crow18-Sep-08 5:26 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
simon alec smith18-Sep-08 5:30
simon alec smith18-Sep-08 5:30 
AnswerRe: Ratio result placing a square not working - when resizing window [modified] Pin
Iain Clarke, Warrior Programmer18-Sep-08 5:29
Iain Clarke, Warrior Programmer18-Sep-08 5:29 
AnswerRe: Ratio result placing a square not working - when resizing window Pin
Mark Salsbery18-Sep-08 5:56
Mark Salsbery18-Sep-08 5:56 
QuestionWinInet issue Pin
George_George18-Sep-08 4:16
George_George18-Sep-08 4:16 
QuestionDrawing wider dashed lines Pin
softwaremonkey18-Sep-08 2:18
softwaremonkey18-Sep-08 2:18 
AnswerRe: Drawing wider dashed lines Pin
Cedric Moonen18-Sep-08 2:35
Cedric Moonen18-Sep-08 2:35 

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.