110,545
社区成员
发帖
与我相关
我的任务
分享
pd.DefaultPageSettings.PaperSize = new PaperSize("Custum", 240, 160);
e.Graphics.DpiX .ToString ()的值为"203"! e.Graphics.DrawString(Lab_ID.Text, new Font(new FontFamily("黑体"), 16, FontStyle.Bold), System.Drawing.Brushes.Black, 10, 15);
这时打印的字(Lab_ID.Text)离打印纸的左边为10个像素,我假设这个距离为1厘米,
在第二次打印前,我将打印机的打印分辨率调高一倍,那么同样是10个像素的边距,会不会是0.5厘米呢?PrintDocument pd = new PrintDocument();
PageSettings df = new PageSettings();
df.PaperSize = new PaperSize("A4", 300, 142);
PrinterResolution pr = new PrinterResolution();
pr.X = 1200;
pr.Y = 1200;
df.PrinterResolution = pr;
pd.DefaultPageSettings = df;
打印机的DPI是可以设置的,在首选项也能看到喔