简体   繁体   English

底部边距不起作用。 MFC项目

[英]Bottom margins doesn't work. Project in MFC

I am working with C++ MFC framework for WindowsCE 2013 My purpose is prepare the correct form of printing.我正在使用 WindowsCE 2013 的 C++ MFC 框架我的目的是准备正确的打印形式。 I initialized PAGESETUPDLG structure and initialized it with the following values Unfortunatelly psd.rtMinMargin.bottom = 500;我初始化PAGESETUPDLG结构并使用以下值初始化它不幸的是psd.rtMinMargin.bottom = 500; which should have value like 0,5 inch doesn't work.应该有像 0.5 英寸这样的值是行不通的。 Regardless of the value set on the printout, it is always 1 inch.无论打印输出上设置的值如何,它始终为 1 英寸。 I cannot explain what is the reason for this.我无法解释这是什么原因。

BOOL Druk::Configuration()
{
    TCHAR DriverName[256];
    TCHAR DeviceName[256];
    TCHAR OutputName[256];
    ZeroMemory(&psd, sizeof(psd));
    psd.lStructSize = sizeof(psd); // psd is member of PAGESETUPDLG structure
    //psd.hwndOwner = hWnd;
    psd.hDevMode = NULL; // Don't forget to free or store hDevMode.
    psd.hDevNames = NULL; // Don't forget to free or store hDevNames.
    psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS;
    psd.rtMargin.top = 100;
    psd.rtMargin.left = 100;
    psd.rtMargin.right = 100;
    psd.rtMargin.bottom = 500; 
    psd.rtMinMargin.bottom = 500;
    lf_vertic.lfHeight = 30; // is member of LOGFONT structure
    lf_vertic.lfWidth = 0;
    //lf.lfOrientation = 2700;
    lf_vertic.lfEscapement = 0;
    lf_vertic.lfUnderline = FALSE;
    lf_vertic.lfWeight = FW_BOLD;
    lf_horizont.lfHeight = 30;
    lf_horizont.lfWidth = 0;
    //lf.lfOrientation = 2700;
    lf_horizont.lfEscapement = 2700;
    lf_horizont.lfUnderline = FALSE;
    lf_horizont.lfWeight = FW_BOLD;
    hFontVertic = CreateFontIndirect(&lf_vertic);
    hFontHorizont = CreateFontIndirect(&lf_horizont);
    DWORD error;
    if (PageSetupDlg(&psd) == TRUE)
    {
        memcpy(&dm, (DEVMODE *)(psd.hDevMode), sizeof(DEVMODE));
        lstrcpy(DriverName, ((TCHAR *)((BYTE *)psd.hDevNames + ((DEVNAMES *)psd.hDevNames)->wDriverOffset)));
        lstrcpy(DeviceName, ((TCHAR *)((BYTE *)psd.hDevNames + ((DEVNAMES *)psd.hDevNames)->wDeviceOffset)));
        lstrcpy(OutputName, ((TCHAR *)((BYTE *)psd.hDevNames + ((DEVNAMES *)psd.hDevNames)->wOutputOffset)));
        //hDC = CreateDC(DriverName, DeviceName, OutputName, &dm); // Wersja dla WinAPI do usunięcia w wersji finalnej
        hDC.CreateDC(DriverName, DeviceName, OutputName, NULL);
    }
    error = CommDlgExtendedError();
    return TRUE;

According to https://learn.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-pagesetupdlga根据https://learn.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-pagesetupdlga

rtMinMargin

Type: RECT类型: RECT

The minimum allowable widths for the left, top, right, and bottom margins.左、上、右和下边距的最小允许宽度。 The system ignores this member if the PSD_MINMARGINS flag is not set.如果未设置PSD_MINMARGINS标志,系统将忽略此成员。

And you do not have that PSD_MINMARGINS flag set而且您没有设置PSD_MINMARGINS标志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mfc 加速键 Ctrl + 不起作用 - mfc accelerators Ctrl + doesn't work MFC组合框killfocus不起作用 - MFC combobox killfocus doesn't work qt中标题的Groupbox对齐不起作用。 为什么? - Groupbox alignment of title in qt doesn`t work. Why? Visual Studio Community 2015 MFC空项目无法编译 - Visual Studio Community 2015 MFC empty project doesn't compile auto/ decltype Error 我很好奇为什么代码不起作用。 (E0252) - auto/ decltype Error I'm curious why the code doesn't work. (E0252) Ncurses 包含在 Cygwin 中,但 getch() 不起作用。 说这是一个未声明的标识符 - Ncurses is included on Cygwin, but getch() doesn't work. Says it's an undeclared identifier (Qt)Qtimer不起作用。 我错过了哪些细节? - (Qt) Qtimer doesn't work. What details have I missed? 试图找到数字的平方根,但是代码不起作用。 C ++ - trying to find the squareroot of a number but code doesn't work. C++ 即使在指定共享 dll 之后,MFC 应用程序也无法构建项目? 网上找的方法都试过了还是不行 - MFC application failing to build project even after shared dll specified? I tried all the ways I found on online but it still doesn't work Qt应用程序部署不起作用。 缺少入口点和dll - Qt-Application Deployment doesn't work. Missing entry point and dll's
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM