RE: Programmatically space controls evenly
- From: Morten Wennevik [C# MVP] <MortenWennevik@xxxxxxxxxxx>
- Date: Sun, 14 Jun 2009 22:29:01 -0700
Hi,
To add to Stephany's post, there are no methods that you can use to space
controls evenly. You have to calculate the positions yourself. That being
said, it is fairly simple math, and you can easily recalculate the positions
when the SizeChanged event is triggered to support resizing of the dialog.
--
Happy Coding!
Morten Wennevik [C# MVP]
"proxyuser" wrote:
Let's say you had a dialog where you wanted to display either 2 or 3.
buttons, but either way you wanted them spaced evenly across the bottom. In
other words, sometimes there are 2 buttons with the 3rd hidden, but when the
3rd unhides you want the other 2 to shift over. In the Designer, you can
select them and click on Make Horizontal Spacing Equal. Is there a way to
do this programmatically? It seems tedious to have to actually figure out
the pixels to move each button.
- Follow-Ups:
- Re: Programmatically space controls evenly
- From: proxyuser
- Re: Programmatically space controls evenly
- References:
- Programmatically space controls evenly
- From: proxyuser
- Programmatically space controls evenly
- Prev by Date: RowState remains Unchanged after edit in DataGridView
- Next by Date: Re: Programmatically space controls evenly
- Previous by thread: Re: Programmatically space controls evenly
- Next by thread: Re: Programmatically space controls evenly
- Index(es):