Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
« »

Twips per pixel in .NET

Blogged by Björn Meyer on February 28, 2006 and tagged with Samples, .NET.

Sometimes, it is required to convert 1/100 inch to twips (twentieth of a point) or vice versa. As the amount of twips in an inch is dependend on the current screen resolution, you have to know this resolution value to convert it properly.

The Graphics object that is returned in the event arguments of the Paint event is able to help you in this case:

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
float DpiX = e.Graphics.DpiX;
float DpiY = e.Graphics.DpiY;
}

1 inch = 1440 twips

Then 1440 / DpiX = TwipsPerPixel

« Prev:Service Pack 2 for TX Text Control 12.0 released
» Next:Protecting parts of a document

Comments

If you would like to comment on this blog entry, please post a comment.

External verification page for ISO 9000:2000 certificate
ISO 9001:2000
certified