I have recently started using SharpDevelop 4.4.1 (running on Windows XP) in order to learn VB.Net. I have done quite a bit of VB6 and vba in the past.
I have been configuring controls on a form to automatically resize with that form. After encountering problems with one method, I tried another and encountered problems there as well. Perhaps someone can advise (bearing in mind that I am newish to both the .Net version of VB, and the development environment).
METHOD 1:
I configured various controls on a form to be anchored at the appropriate sides. This worked well. However, there are two GroupBoxes that I would like to have an equal share of the available height. I don't think I can do this with straightforward anchoring so I wrote a few lines of code in the form's Layout event procedure. This sets the height correctly, but it seems to have the unwanted side effect of preventing the anchoring from working properly.
Private Sub Form1_Layout(ByVal sender As Object, _
ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout
groupBox1.Size=New System.drawing.size(groupBox1.Width,(Me.height - grpSource.height-60)/2)
groupBox2.Size = New System.Drawing.Size(groupBox2.Width,groupBox1.Height)
groupBox2.top = groupBox1.top+groupBox1.Height+5
End Sub
If I comment out the three lines in this procedure, the anchoring is fine and the controls are correctly sized in the horizontal - although of course the group boxes to not auto-fit vertically. With the lines of code reinstated, the vertical sizing is as intended but the horizontal anchoring stops working properly. (It sort-of works, but it seems to only recognize horizontal resizing if the form is resized only in the horizontal dimension. Any diagonal movements and the controls remain unchanged.)
Since that didn't work as expected I tried using a split container control instead of the Layout event handler.
METHOD 2:
I added a split container control called SplitContainer1 and set the orientation property to 'horizontal'. I then put the two GroupBox controls in the two panels and anchored them at all sides. However, now there is a compile-time error caused by the following in Form1.Designer.vb:
Me.splitContainer1.Panel1.Controls.Add(Me.groupBox1)
AddHandler Me.splitContainer1.Panel1.Paint, AddressOf Me.Panel1Paint
The second line casuses the error " Error BC30456: 'Panel1Paint' is not a member of 'Test5.Form1'". Since this code is created by SharpDevelop I don't really know what I can do about it.
So... a bit stuck.