对于运行我的应用程序的任何显示器,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 像素有多长吗?
DPI 字面意思是“每英寸点数”——其中点数==像素。因此要确定 1200 像素有多长:
int inchesLong = (1200 / e.Graphics.DpiX);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)