How to do this?

M

Mika M

Let's say, Form has MainMenu-, ToolBar-, and StatusBar controls on it.
The rest of the are will be used for example by grid- and chart
controls. Question: how to make grid- and chart controls to use half of
the area, ie. resize height, after Form is resized? I mean grid would
have upper half of the area, and chart bottom half of the area, ie. both
of these two controls has same height and they are like stacked on the
area on the form.

Using Anchors of the controls it is possible to anchor for the grid:
Top, Left, Right, and for the chart: Bottom, Left, Right, but how to
change height as half of the area for them both?
 
C

Cor Ligthert

Mika,

This question of you can have a simple answer.

That is why there are panels.

Cor
 
P

Peter Proost

Hi Mika,

this is a piece of code to keep 2 datagrids the same size, so maybe it can
help you, you maybe have to change the -8 and -24 for your project, you'll
just have to try what gives the best result.

hth Greetz Peter

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) _ Handles MyBase.Resize
DataGrid1.Width = Me.Width - 8
DataGrid2.Width = Me.Width - 8
DataGrid2.Height = (Me.Height - 24) / 2
DataGrid1.Height = (Me.Height - 24) / 2
DataGrid2.Location = New Point(0, DataGrid1.Height)
End Sub
 
M

Mika M

Okay, good to know, but I don't know how to use it in this case :(

Any examples? How about splitter? Is it possible to use as hozontal?
 
C

Cor Ligthert

Mika,

In my opinion should you just try those things, it is even not simple to
give a sample.

Drag a panel on your form
Drag on that another panel and dock that left
Drag in that a datagrid and dock that center
Than drag on that panel a spliter and position it right

Try,

I am not complete sure on what panel that splitter should be however I
thought on the top one.
Otherwise the position is of course left. Try it yourself, that is what I
should do also.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top