Hey
I need to set a form's interior size to specific dimensions.
frm.Width and frm.Height define not only the form's interior but also include window borders and possibly other things, which vary in size, and I don't care about those. frm.ScaleWidth and frm.ScaleHeight define the form's interior and I am interested in programmatically setting the interior size to specific dimensions. Unfortunately both of these properties are read-only.
How can one do that?
One idea I have is to first determine the size of the borders and then to set the form's size to the desired size + borders:
Is there a better way?
I need to set a form's interior size to specific dimensions.
frm.Width and frm.Height define not only the form's interior but also include window borders and possibly other things, which vary in size, and I don't care about those. frm.ScaleWidth and frm.ScaleHeight define the form's interior and I am interested in programmatically setting the interior size to specific dimensions. Unfortunately both of these properties are read-only.
How can one do that?
One idea I have is to first determine the size of the borders and then to set the form's size to the desired size + borders:
Code:
reqXPx = 1280
reqYPx = 768
borderXTw = frm.Width - frm.ScaleWidth
borderYTw = frm.Height - frm.ScaleHeight
frm.Width = pixelsToTwipsH(reqXPx) + borderXTw
frm.Height = pixelsToTwipsV(reqYPx) + borderYTw