How can I set the width of a form in inches (or cm) instead of pixels?
I want to print the form, so it needs to always be the same dimensions (4" by 6"). I saw some examples for previous versions of VB, but nothing that works in VB10.
Thanks,
Alex
Printable View
How can I set the width of a form in inches (or cm) instead of pixels?
I want to print the form, so it needs to always be the same dimensions (4" by 6"). I saw some examples for previous versions of VB, but nothing that works in VB10.
Thanks,
Alex
here's how to set it in inches:
vb Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim gr As Graphics = Me.CreateGraphics Me.SetClientSizeCore(CInt(4 * gr.DpiX), CInt(6 * gr.DpiY)) '4 by 6 (w by h) End Sub End Class
for cm: 1 inch = 2.54 cm
Thanks!