[英]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.