In a message regarding Re: Button size dated Wed, 16 Aug 2006 23:46:11
-0400, Brian Heibert said that ...

> actually what I want to do is make the pushbutton bigger when the
> different translation is picked from my language menu
> I am a little confused on the stuff you gave below

One way to follow Andrew's excellent advice would be to create a method
like this

Sub setTextAndWidth(ctrl As PushButton, txt As String)
  Dim p As New Picture(1, 1, 32)
  Dim g As Graphics = p.Graphics
  Dim lng As Integer

  g.TextFont = ctrl.TextFont
  g.TextSize = ctrl.TextSize

  lng = g.StringWidth(txt)
  ctrl.Width = lng + 20
  ctrl.Caption = txt

End Sub

and call it like this

  setTextAndWidth ( PushButton1, "Hello" )
  setTextAndWidth ( PushButton2, "Rumpelstitskin" )


--
Steve Garman
Using REALbasic 2006r2 Professional on Windows XP Pro


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to