Label and TextLabel: Fix autoresize.

[GB.GUI.BASE]
* BUG: Label and TextLabel: Fix autoresize.
This commit is contained in:
gambas 2021-03-04 22:46:29 +01:00 committed by Christof Thalhofer
parent aefee813e2
commit 1211dafb21

View file

@ -91,12 +91,13 @@ Public Sub _UpdateSize()
Dim W As Integer Dim W As Integer
Dim H As Integer Dim H As Integer
Dim P As Integer Dim P As Integer
Dim hRect As Rect
$hExt = Null $hExt = Null
If $bLocked Then Return
If Me.Design Then Return If Me.Design Then Return
If Not $bAutoResize Then Return If Not $bAutoResize Then Return
If Not $sText Then Return If Not $sText Then Return
If $bLocked Then Return
$bLocked = True $bLocked = True
@ -104,17 +105,17 @@ Public Sub _UpdateSize()
If $bRichText Then If $bRichText Then
If _Wrap Then If _Wrap Then
W = Me.W hRect = Me.Font.RichTextSize($sText, Me.W - P * 2)
H = P * 2 + Me.Font.RichTextHeight($sText, W - P * 2)
Else Else
W = P * 2 + Me.Font.RichTextWidth($sText) hRect = Me.Font.RichTextSize($sText)
H = P * 2 + Me.Font.RichTextHeight($sText)
Endif Endif
Else Else
W = P * 2 + Me.Font.TextWidth($sText) hRect = Me.Font.TextSize($sText)
H = P * 2 + Me.Font.TextHeight($sText)
Endif Endif
W = hRect.W + P * 2
H = hRect.H + P * 2
If Align.IsMiddle($iAlign) Then If Align.IsMiddle($iAlign) Then
If H < Me.H Then H = Me.H If H < Me.H Then H = Me.H
Endif Endif