Hi,
I want to show only the first line of characters which fit on the screen, depending on different devices
and resolutions. A label has no wrap = false function, so I try to calculate the
number of characters which could be shown.
On 2 devices it work, and on the third not. I get more characters, so a second line.
Sub CreateListItem(Line1 As String,Line2 As String, Width As Int, Height As Int) As Panel
Dim p As Panel
Dim X As Int
Dim W As Int
....
'A long line
' 320x480 : 950646048906845906 459068450964
' 480 x ... : 950646048906845906 459068450964590690469 05946459068540964 054
'
line2 = "950646048906845906 459068450964590690469 05946459068540964 05469054690..."
....
X = C.MeasureStringWidth(Line2, Typeface.DEFAULT, 12)
W = Width-15dip
If W < X Then
X = W / (X / Line2.Length)
Line2=Line2.SubString2(0, X)
End If
'Adding to a customlistview
p.AddView(lbl2, 15dip, 22dip, Width - 15dip, Height - 12dip) 'view #0
....
I want to show only the first line of characters which fit on the screen, depending on different devices
and resolutions. A label has no wrap = false function, so I try to calculate the
number of characters which could be shown.
On 2 devices it work, and on the third not. I get more characters, so a second line.
Sub CreateListItem(Line1 As String,Line2 As String, Width As Int, Height As Int) As Panel
Dim p As Panel
Dim X As Int
Dim W As Int
....
'A long line
' 320x480 : 950646048906845906 459068450964
' 480 x ... : 950646048906845906 459068450964590690469 05946459068540964 054
'
line2 = "950646048906845906 459068450964590690469 05946459068540964 05469054690..."
....
X = C.MeasureStringWidth(Line2, Typeface.DEFAULT, 12)
W = Width-15dip
If W < X Then
X = W / (X / Line2.Length)
Line2=Line2.SubString2(0, X)
End If
'Adding to a customlistview
p.AddView(lbl2, 15dip, 22dip, Width - 15dip, Height - 12dip) 'view #0
....