vb.net - Ways to go about resizing controls in resizable windows? -


I have two with a VB 2005 form size and need to move up three buttons in between them in The DataGridView control is, around the size of the form.

The code below works, and whatever I want. It takes the difference between the new size and default size, divides the height difference between two DataGridViews, and moves things around correctly.

missed what I'm about bugs that I have hard-coded ResizeEnd handler I would go about how to pass the default size, so I will not repeat itself?

Even better, is there a way to do this with anchoring, docking and other stuff, so that I can not even write the code in advance?

Thank you!

  private sub dlgShowAssets_ResizeEnd (ByVal new System.Drawing.Size as this object, ByVal e As System.EventArgs) Handles Me.ResizeEnd dim defaultWindowSize (759, 619) dim defaultAssetDGVSize New System.Drawing.Size (730, 153) dim defaultAssetDGVPos New System.Drawing.Point (9, 186) as well as dim defaultButton1Pos New System.Drawing.Point (9, 345) dim defaultButton2Pos new System.Drawing.Point (100, 345) as dim defaultButton3Pos new System.Drawing.Point (191, 345) in as dim defaultDetailDGVSize new System.Drawing.Size (730, 177) dim defaultDetailDGVPos new system As drey I Points like (9, 374) Dim Deltax = I Size With - DefaultWindows Seiz. With Them DeltaAge Integer = Me Size High - default Wi ndowSize.Height dim deltaSize New System.Drawing.Size (deltaX, deltaY / 2) in as dim deltaPos New System.Drawing.Point (0, deltaY / 2) Me.AssetDataGridView.Size = defaultAssetDGVSize + deltaSize Me.btnAddAsset.Location = DefaultButton1Pos + deltaPos Me.btnEditAsset.Location = defaultButton2Pos + deltaPos Me.btnDeleteAsset.Location = defaultButton3Pos + Deltapos Me.AssetIdentifierDataGridView.Size = defaultDetailDGVSize + Deltaakar to Me.AssetIdentifierDataGridView.Location = defaultDetailDGVPos + Deltapos closing sub  

You can use the TableLayoutPanel control.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -