【发布时间】:2011-07-04 13:41:03
【问题描述】:
对于运行我的应用程序的任何显示器,Dpi 点与像素有何关系?
int points;
Screen primary;
public Form1() {
InitializeComponent();
points = -1;
primary = null;
}
void OnPaint(object sender, PaintEventArgs e) {
if (points < 0) {
points = (int)(e.Graphics.DpiX / 72.0F); // There are 72 points per inch
}
if (primary == null) {
primary = Screen.PrimaryScreen;
Console.WriteLine(primary.WorkingArea.Height);
Console.WriteLine(primary.WorkingArea.Width);
Console.WriteLine(primary.BitsPerPixel);
}
}
我现在是否拥有所需的所有信息?
我可以使用以上任何信息来找出 1200 像素的长度吗?
【问题讨论】:
-
注意:一旦我学会了如何通用地显示我的表单,该表单上的数据将被发送到打印机 - 因此标题中的
PrintPageEventArgs。
标签: c# winforms graphics printing dpi