You will want to include a small buffer value as the tabs themselves have a height/width value too...
' tabs on the top
CommandButton1.Left = MultiPage1.Width - CommandButton1.Width - 5
CommandButton1.Top = MultiPage1.Height - CommandButton1.Height - 20
' tabs on the left
CommandButton1.Left = MultiPage1.Width - CommandButton1.Width - 48
CommandButton1.Top = MultiPage1.Height - CommandButton1.Height - 5
Adjust the numbers to give it the effect you want.
When the tabs are on the left, the width value is going to depend on how wide the tabs need to be in order for the text on them to fit. The values I used are for when the default tab text "Page1" and "Page2" are used.
If you decide to set the values of TabFixedWidth
or TabFixedHeight
(they default to 0), then you will want to use them in the calculation as well, or just use a larger adjustment value.
Note: the values will need to be adjusted if you change the size of the font for the tabs too, so you cannot just automatically assume that the values I gave you are going to work in your case.
Now think to yourself, is the size of the MultiPage really going to change at runtime? If so, you are going to have to write a lot of of code for each control on each page too, which you will eventually realize is going to be more effort than it is worth. Usually when people design something like this, all controls on each page are going to be in a static position, so none of this is needed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…