简体   繁体   English

如何使用命名空间System.Drawing.Printing设置标签大小?

[英]How to set label size using namespace System.Drawing.Printing?

How to set label size using namespace System.Drawing.Printing. 如何使用名称空间System.Drawing.Printing设置标签大小。 Of Fix size? 固定大小? I want 6 labels of some size on a page size of 8.5X11 我希望页面尺寸为8.5X11的6个标签具有一定的尺寸

In .net you can use a PrintPage handler for the PrintDocument object. 在.net中,可以为PrintDocument对象使用PrintPage处理程序。 Inside the PrintPage handler, use e.graphics for the printer output. 在PrintPage处理程序内,将e.graphics用于打印机输出。 With e.graphics, the location and size is based on 100 pixels per inch, regardless of the printer's resolution. 对于电子图形,无论打印机的分辨率如何,其位置和尺寸均基于每英寸100像素。 So, for example, if you want 6 evenly spaced labels over 8 inches, you could position them 114 units apart, 100 * 8/(6+1), (plus the location of the first label). 因此,例如,如果要在8英寸上放置6个均匀间隔的标签,则可以将它们分开放置114个单位,即100 * 8 /(6 + 1)(加上第一个标签的位置)。

要为Draw方法提供参数时,要绘制的任何东西都一定具有您指定的大小。框架不会对此进行更改。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM