Setzen Sie nicht die Größe der Papierpapier in den Bereichen UI -Druckereinstellungen einC++

Programme in C++. Entwicklerforum
Anonymous
 Setzen Sie nicht die Größe der Papierpapier in den Bereichen UI -Druckereinstellungen ein

Post by Anonymous »

Die Papiergröße für die Druckereinstellungen der Druckereinstellungen nicht mit PrintDialOgex einstellen, gibt es immer die Einstellung für den Buchstaben in MFC. Bitte lassen Sie es mich für ein Problem wissen. < /P>

Code: Select all

PRINTPAGERANGE cRangeBuffer[CXPrintRangeData::PRINTRANGE_Maximum];

ASSERT(pInfo != NULL);
ASSERT(pInfo->m_pPD != NULL);
CWinApp* pApp = AfxGetApp();

if ( pInfo->m_pPD->m_pd.nMinPage > pInfo->m_pPD->m_pd.nMaxPage )
pInfo->m_pPD->m_pd.nMaxPage = pInfo->m_pPD->m_pd.nMinPage;

pInfo->m_pPD->m_pd.nFromPage = (WORD)pInfo->GetMinPage();
pInfo->m_pPD->m_pd.nToPage = (WORD)pInfo->GetMaxPage();

pInfo->m_pPD->m_pd.Flags &= ~PD_SHOWHELP;

CPrintDialogEx dlg;

dlg.m_hWndOwner = NXSystem::GetMainWnd()->m_hWnd;
dlg.m_pdex.Flags = PD_ALLPAGES | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
dlg.m_pdex.nCopies = 1;
dlg.m_pdex.nMinPage = (WORD)pInfo->GetMinPage();
dlg.m_pdex.nMaxPage = (WORD)pInfo->GetMaxPage();
dlg.m_pdex.lpPageRanges = cRangeBuffer;
dlg.m_pdex.nMaxPageRanges = bOnePrintRange ? 1 : CXPrintRangeData::PRINTRANGE_Maximum;

dlg.m_pdex.hDevMode = CXPrinter::CopyDevMode(pInfo->m_pPD->m_pd.hDevMode);
dlg.m_pdex.hDevNames = pInfo->m_pPD->m_pd.hDevNames;

// --- Set desired paper size here ---
DEVMODE* pDevMode = (DEVMODE*)GlobalLock(dlg.m_pdex.hDevMode);
if ( pDevMode )
{
pDevMode->dmFields |= DM_PAPERSIZE;      // Enable paper size
pDevMode->dmPaperSize = DMPAPER_A4;      // Change to required size (e.g., DMPAPER_LETTER)
GlobalUnlock(dlg.m_pdex.hDevMode);
}

if ( !(nOptions & PRINT_Current) )
dlg.m_pdex.Flags |= PD_NOCURRENTPAGE;
if ( !(nOptions & PRINT_Pages) )
dlg.m_pdex.Flags |= PD_NOPAGENUMS;
if ( !(nOptions & PRINT_Selected) )
dlg.m_pdex.Flags |= PD_NOSELECTION;
if ( !(nOptions & PRINT_ToFile) )
dlg.m_pdex.Flags |= PD_HIDEPRINTTOFILE;

if ( !pInfo->m_bPreview )
{
INT_PTR response = dlg.DoModal();
if ( response != S_OK || dlg.m_pdex.dwResultAction != PD_RESULT_PRINT )
return FALSE;       // do not print
}
else if( pInfo->m_pPD->m_pd.hDC == NULL )
{
dlg.m_pdex.hDC  = CXPrinter::CreateDC(dlg.m_pdex.hDevNames,
dlg.m_pdex.hDevMode);
if ( !dlg.m_pdex.hDC )
return FALSE;
}

if ( pApp )
pApp->SelectPrinter(dlg.m_pdex.hDevNames, dlg.m_pdex.hDevMode, TRUE);
< /code>
 < /p>

update < /h2>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post