VB Code:
Private Sub UserControl_Resize()
With UserControl
.Width = (intButtonWidth * IIf(ebsoButtonOrientation = EBSOrientations.bsHorizontal, intNumButtons, 1)) * Screen.TwipsPerPixelX
.Height = (intButtonHeight * IIf(ebsoButtonOrientation = EBSOrientations.bsVertical, intNumButtons, 1)) * Screen.TwipsPerPixelY
End With
DrawButtons
Debug.Print "resizing"
Debug.Print intButtonWidth * IIf(ebsoButtonOrientation = EBSOrientations.bsHorizontal, intNumButtons, 1), UserControl.Width \ Screen.TwipsPerPixelX
Debug.Print intButtonHeight * IIf(ebsoButtonOrientation = EBSOrientations.bsVertical, intNumButtons, 1), UserControl.Height \ Screen.TwipsPerPixelY
End Sub
If the orientation is horizontal, the final control width is equal to the number of buttons times the width of one button, and the height is just the height of one button. For vertical, the width is just one button, and the height is one button times number of buttons. In both cases, the single button dimension and the screen dimension are the same, so that IIf() will either return the number of buttons for the right size, or just 1 so it won't affect it. The rest is just what tells me the size currently is, and what it should be (in pixels). I've noticed the property window isn't always in synch, which is beyond my understanding... It's ticking me off.