How do I convert Twips to Pixels in .NET?

前端 未结 4 1777
渐次进展
渐次进展 2020-12-09 03:12

I\'m working on a migration project in which a database actually stores display sizes in twips. Since I can\'t use twips to assign sizes to WPF or Winforms controls, I was w

4条回答
  •  执笔经年
    2020-12-09 03:27

    Old post I know but here is an FYI and some math for the 1440 answers above...

    A twip is not simply 1/1440th of an inch. A twip is 1/20 of a point.

    The point you are working with in a printable document, typically, is a postscript 72dpi:

    72dpi * 20Twips/Point = 1440twips.

    So in dealing with say a Crystal report, with a twips width of 15840 (and margins of 0 twips), the width would be 11 inches (15840 / (72 * 20)).

    Based on a screen density of 96 dpi, the report will post to the screen at:

    1056px wide (96dpi * 11in = 1056px).

提交回复
热议问题