C#中获取当前DPI

在C#中,获取当前系统的DPI,凭证的可视化打印中用到。

Using(Graphics g = this.CreateGraphics())
{
     Int dpi = (int)g.DpiX;
}

其实就是通过在当前环境下创建一个图形,来获取Dpi 。

顺便试下代码高亮 :-)

1 Comment

One Comment

  1. 不错,谢谢分享你的经验

Leave a Reply

7+12=

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>