1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
Sub DrawBtnTxt(inPct As PictureBox, lbLeft%, lbTop%, lbRight%, lbBottom%, lbText$, lbHorzAlign$, txVertAlign$, inMultiLine%)
.
.
.
.
.
.
'Calculate the Y position
inPct.CurrentY = lbTop + (((lbBottom - lbTop) * lbVertAlign) - (inTextHeight * lbVertAlign))
'Don't let it go over the top
If inPct.CurrentY < lbTop Then
inPct.CurrentY = lbTop
End If
For inElement = 1 To UBound(arText) 'Loop thru all element strings
Select Case LCase(lbHorzAlign)
Case "left"
inPct.CurrentX = lbLeft
Case "right"
inPct.CurrentX = lbRight - inPct.TextWidth(arText(inElement)) - 3
Case "center"
inPct.CurrentX = lbLeft + (((lbRight - lbLeft) / 2) - (inPct.TextWidth(arText(inElement)) / 2))
Case Else 'Default "center"
inPct.CurrentX = lbLeft + (((lbRight - lbLeft) / 2) - (inPct.TextWidth(arText(inElement)) / 2))
End Select
inPct.Print arText(inElement)
Next
ReDim arText(0)
End Sub |