I am trying to do the following...
But the padding (of 15) is not the same on both sides. It seems like I need to be dealing with the VB6 equivalent of ScaleWidth. Any ideas?VB Code:
TextBox1.Left = 15 Me.Width = TextBox1.Right + 15
Printable View
I am trying to do the following...
But the padding (of 15) is not the same on both sides. It seems like I need to be dealing with the VB6 equivalent of ScaleWidth. Any ideas?VB Code:
TextBox1.Left = 15 Me.Width = TextBox1.Right + 15
lol, I was asking the same some days ago. There is no direct way to replace these methods (they are are no more supported): Scalemode, ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight.
This link talks about this and presents a solution, but, I have to say I still can't find a way to create a coorditante system in VB.Net as we use to do it in VB6. Anyway, maybe this is the answer you're looking for..
http://msdn.microsoft.com/library/de...l/vbup2038.asp
I guess my question breaks down to a few things:
1) Does the Form.Width property return the width of the form (including the form border)?
2) Does the .Left property return the distance from the inner boundry of the form (not including the border) or the outer boundry (including the form).
If the answer is yes to both of those, then why is there no way to get the width of the border of the form? That seems crazy to me.
It is the Size of the form in pixels. So Width is in pixels and not twips etc.
If you want the size without the borders then you can use the ...
Me.ClientSize.Width() for no borders.
Me.ClientSize.Height() will return the height - the borders and menu, if any.
If your setting the width and height then just set the .Size property instead.
Width or the borders can be calculated by (Me.Width - Me.ClientSize.Width) / 2
Thanks RobDog. That's just what I needed. :)
Oh ya, and heres a bonus one - To set the position of a form (right docked appearance for ex.) use
Me.Location = New System.Drawing.Point(Screen.PrimaryScreen.Bounds.Width - Me.Width, Screen.PrimaryScreen.Bounds.Height - Me.Height)
Thanx, this is just what I've been looking for.