By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

Pixel sizing

P: 3
Hi I would like to know why is it that when I draw a rectangle onto the form at 400 pixels high, when I count the number of pixels on my PC, I count 401 pixels. I've checked it on other computers and get values like 393, 397 ect. Here's the code I use to draw the rectangle:

Dim rec1 As New Rectangle(0, 0, 70, 400)
e.Graphics.DrawRectangle(Pens.Black, rec1)
e.Graphics.FillRectangle(Brushes.Black, rec1)

Dim rec2 As New Rectangle(230, 0, 70, 400)
e.Graphics.DrawRectangle(Pens.Black, rec2)
e.Graphics.FillRectangle(Brushes.Black, rec2)

Dim rec3 As New Rectangle(70, 165, 200, 70)
e.Graphics.DrawRectangle(Pens.Black, rec3)
e.Graphics.FillRectangle(Brushes.Black, rec3)

Can someone please explain why this is happening. The graphic has to be exact. Help would greatly be appreciated.

Thank you
Sep 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: 15
have you tried sizing the rectangle in twips rather than pixels ? im not sure if this would be more accurate but i can remember reading about this a while back.
Sep 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.