Drag a splitter by coding

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi,

Does anyone know how to drag a splitter by coding.

I will put three controls on form1,two panels and a splitter. The first
panel's dock property is set to top, the splitter's dock is also top and the
second panel's dock is fill. Now I want to expand the first panel's area and
shrink the second panel by draging the splitter in code but failed.


Thanks in advance

Peter
 
Hi Peter,

the splitter's location is based on the size of the controls that are above
or left of it.
So you'll have to resize the panel that's docked top.
For example:

Panel1.Size = New Size(Panel1.Size.Width, Panel1.Size.Height + 20)

hth Greetz Peter
 
Peter,

If you want to see the code, than just drag a splitter on your form and open
the little plus before the designer created code.

In most cases the code is wonderfull made, in some cases it looks a little
bit overdone (however that has mostly a very well reason when you overthink
it why they did it that way).

I hope this helps,

Cor
 
Peter said:
Does anyone know how to drag a splitter by coding.

I will put three controls on form1,two panels and a splitter. The
first panel's dock property is set to top, the splitter's dock is
also top and the second panel's dock is fill. Now I want to expand
the first panel's area and shrink the second panel by draging the
splitter in code but failed.


What does "drag by coding" mean? Start the drag operation and the user still
has to move it, or set the position by code? I assume the latter: Set the
Splitter's Splitposition property.

Armin
 
Back
Top