Click here to Skip to main content
13,702,302 members

C / C++ / MFC

 
AnswerRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
Victor Nijegorodov14-Sep-18 0:41
memberVictor Nijegorodov14-Sep-18 0:41 
GeneralRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
zigie16-Sep-18 17:48
memberzigie16-Sep-18 17:48 
GeneralRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
Victor Nijegorodov16-Sep-18 20:25
memberVictor Nijegorodov16-Sep-18 20:25 
AnswerRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
_Flaviu14-Sep-18 0:42
member_Flaviu14-Sep-18 0:42 
GeneralRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
zigie16-Sep-18 18:04
memberzigie16-Sep-18 18:04 
QuestionRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
David Crow14-Sep-18 3:01
memberDavid Crow14-Sep-18 3:01 
AnswerRe: launch a word processor(MS Word) in an MS Visual C++ dialog based application Pin
zigie16-Sep-18 18:14
memberzigie16-Sep-18 18:14 
QuestionThe mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 0:47
memberMember 1388734912-Sep-18 0:47 
I want to print a bitmap. To avoid printing small bitmap I set CScrollView mode as MM_LOMETRIC with sizes 3830x1995. I have created the bitmap and made the bitblt to the screen. There were everythig just like I want on the screen and on the print preview but when I printed the document I`ve got very bad result.

It seems to me that printer does not see a bitmap the same way as print preview does. Pay attantion that the first ractangle puts directly on the DC and memDC puts into it. Are there any ideas how to fix this mismatch between print previw and the real printing?

MFC_T_Print_1.zip[^]

void OnDraw()
{
    CPen pen;
    pen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
    CPen* OldPen = pDC->SelectObject(&pen);

    CRect rcView;
    GetClientRect(rcView);
    int iClientWidth = rcView.right;
    int iClientHeight = rcView.bottom;
    int iMemWidth = 1900;
    int iMemHeight = 950;
    CDC memDC;
    CBitmap memBitmap;
    memDC.CreateCompatibleDC(pDC);
    memBitmap.CreateCompatibleBitmap(pDC, iMemWidth, iMemHeight);
    memDC.SelectObject(&memBitmap);
    memDC.SetMapMode(MM_LOMETRIC);
    CPen pen1;
    pen1.CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
    memDC.SelectObject(&pen1);
    CBrush brBK;
    brBK.CreateSolidBrush(RGB(255, 255, 255));
    memDC.SelectObject(&brBK);
    RECT rc;
    rc.left = 0;
    rc.top = 0;
    rc.right = iMemWidth;
    rc.bottom = iMemHeight;
    memDC.FillRect(&rc, &brBK);
    memDC.Rectangle(rc.left, rc.top, rc.right, -rc.bottom);
    memDC.MoveTo(0, 0);
    memDC.LineTo(1900, -950);

    memDC.MoveTo(0, -950);
    memDC.LineTo(200, -750);

    CFont font;
    font.CreateFont(
        50,                        // nHeight
        0,                         // nWidth
        0,                         // nEscapement
        0,                         // nOrientation
        FW_NORMAL,                 // nWeight
        FALSE,                     // bItalic
        FALSE,                     // bUnderline
        0,                         // cStrikeOut
        ANSI_CHARSET,              // nCharSet
        OUT_DEFAULT_PRECIS,        // nOutPrecision
        CLIP_DEFAULT_PRECIS,       // nClipPrecision
        DEFAULT_QUALITY,           // nQuality
        DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
        _T("Arial"));
    memDC.SelectObject(&font);
    memDC.TextOut(100, -100, _T("Hello"));


    pDC->BitBlt(10, -10, iMemWidth, -iMemHeight, &memDC, 0, 0, SRCCOPY);
    font.DeleteObject();
    brBK.DeleteObject();
    memDC.DeleteDC();
    memBitmap.DeleteObject();
    pen.DeleteObject();
    pen1.DeleteObject();
}

void OnInitialUpdate()
{
    CScrollView::OnInitialUpdate();

    CSize sizeTotal;
    sizeTotal.cx = 3830;
    sizeTotal.cy = 1995;
    SetScrollSizes(MM_LOMETRIC, sizeTotal);
}

MFC

AnswerRe: The mismatch between Print preview and the real printing Pin
Richard MacCutchan12-Sep-18 0:57
protectorRichard MacCutchan12-Sep-18 0:57 
GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 2:03
memberMember 1388734912-Sep-18 2:03 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer12-Sep-18 7:05
memberleon de boer12-Sep-18 7:05 
GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734912-Sep-18 21:07
memberMember 1388734912-Sep-18 21:07 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer13-Sep-18 0:47
memberleon de boer13-Sep-18 0:47 
GeneralRe: The mismatch between Print preview and the real printing Pin
Member 1388734913-Sep-18 3:18
memberMember 1388734913-Sep-18 3:18 
GeneralRe: The mismatch between Print preview and the real printing Pin
leon de boer13-Sep-18 5:29
memberleon de boer13-Sep-18 5:29 
QuestionThread synchronization problem Pin
samzcs10-Sep-18 9:12
membersamzcs10-Sep-18 9:12 
AnswerRe: Thread synchronization problem Pin
Richard Andrew x6410-Sep-18 9:35
professionalRichard Andrew x6410-Sep-18 9:35 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 10:09
membersamzcs10-Sep-18 10:09 
GeneralRe: Thread synchronization problem Pin
Richard Andrew x6410-Sep-18 10:11
professionalRichard Andrew x6410-Sep-18 10:11 
GeneralRe: Thread synchronization problem Pin
samzcs10-Sep-18 10:28
membersamzcs10-Sep-18 10:28 
QuestionRe: Thread synchronization problem Pin
CPallini10-Sep-18 21:02
mvpCPallini10-Sep-18 21:02 
AnswerRe: Thread synchronization problem Pin
samzcs11-Sep-18 2:45
membersamzcs11-Sep-18 2:45 
GeneralRe: Thread synchronization problem Pin
CPallini11-Sep-18 3:23
mvpCPallini11-Sep-18 3:23 
AnswerRe: Thread synchronization problem Pin
leon de boer10-Sep-18 22:08
memberleon de boer10-Sep-18 22:08 
GeneralRe: Thread synchronization problem Pin
samzcs11-Sep-18 2:50
membersamzcs11-Sep-18 2:50 

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.


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180906.1 | Last Updated 19 Sep 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid