如何在不同的打印机上调整打印尺寸 [英] How to resize prints in different printers

查看:119
本文介绍了如何在不同的打印机上调整打印尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在CDialog框上设置一个程序,该程序将打印一些信息.我有一个小问题.一台打印机可以打印正确的尺寸,而第二台打印机可以打印较小的尺寸.而且我无法更改打印的打印尺寸.有人可以帮我吗?

这是我的代码:

Hi,

I am making a program set on CDialog box which will print some information. And I have a small problem. One printer prints the correct sizes but the second printer prints in smaller sizes. And I am unable to changed the print sizes of the prints. Can somebody help me?

Here is the my code:

void CDELEGACJEDlg::DRUK()
{
     CPrintDialog dlgDRUK(FALSE,PD_ALLPAGES,this);
	CDC p_DC;	
	CRect rcB;
	rcB.SetRect(0,0,2400,3000);
	p_DC.SetMapMode(MM_LOMETRIC);
	if(dlgDRUK.DoModal()==IDOK)
	{	
		p_DC.Attach(dlgDRUK.GetPrinterDC());

		DOCINFO mojDRUK;
		mojDRUK.cbSize = sizeof(mojDRUK);
		mojDRUK.lpszDocName = "DELEGACJE";
		mojDRUK.lpszOutput = NULL;
		mojDRUK.lpszDatatype = NULL;
		mojDRUK.fwType = NULL;
		if(p_DC.StartDoc(&mojDRUK)>0)
		{
                        CFont fn45;
			p_DC.StartPage();
		        fn45.CreateFont(45,0,0,0,0,false,
                        false,false,ANSI_CHARSET,OUT_TT_PRECIS,
                        CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
                        DEFAULT_PITCH,"Arial");
		
			COLORREF kolCZARNY(RGB(0,0,0));
			COLORREF kolBIALY(RGB(255,255,255));
			
			CPen penCZARNY2(PS_SOLID,2,kolCZARNY);
			CPen penBIALY(PS_SOLID,1,kolBIALY);
			CBrush* brOLD = NULL;
			CBrush brSZARY_J(kolSZARY_J);
			CBrush brSZARY_C(kolSZARY_C);
                        brOLD=(CBrush*)p_DC.SelectObject(&brSZARY_J);
                        penOLD=(CPen*)p_DC.SelectObject(&penCZARNY);
	
                        p_DC.SelectObject(&fn45);
			p_DC.SetBkColor(kolSZARY_C);
			p_DC.TextOut(575,280,"Mountain");
			p_DC.SetTextAlign(TA_RIGHT);
			p_DC.TextOut(640,335,"Summit");


			p_DC.EndPage();
			p_DC.EndDoc();
			p_DC.LPtoDP(rcB);
                        p_DC.SelectObject(brOLD);
                        p_DC.SelectObject(penOLD);
		}
		p_DC.DeleteDC();
	}
	CDialog::OnOK();
}



我是否使用p_DC.SetMapMode(MM_LOMETRIC)函数都没有影响.



It isn''t making a difference whether I am using the p_DC.SetMapMode(MM_LOMETRIC) function or not.

推荐答案

您使用的是提供的默认字体在设备上下文中.如果需要特定的大小,则应创建一种字体并将其选择到设备上下文中.请参见此处 [此处 [
You are using the default font that is being provided in the device context. If you want a particular size, you should create a font and select it into the device context. See here[^] and, for more options and an example, here[^].


这可能是一个非常愚蠢的问题,但是您确定两台打印机都支持您选择的字体大小吗?您的代码对我来说看起来不错,但我实际上无法对其进行测试,因为a)我只有一台打印机,b)我没有MFC.
This may be a very foolish question, but are you sure that both printers support the font size you are selecting? Your code looks OK to me, but I cannot actually test it as a)I only have one printer, and b) I do not have MFC.


这篇关于如何在不同的打印机上调整打印尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆