AHilberink Active Member Licensed User Longtime User Nov 1, 2022 #1 Hi, I have a string: B4X: Dim Naam as String = "Jan Jaap - Hoofdstraat 1 Amsterdam" I need to put this on a label in 2 lines, so B4X: Dim lblNaam as label lblNaam.Initialize lblNaam.text = Naam.Replace(" - ",CRLF) This works fine, but I want the first line Size 18 and the second line Size 12. How can I do this? I tried something like this: B4X: Dim BB As BBCodeView BB.Initialize("","") BB.Text=naam'.Replace(" - ",CRLF) BB.Text="[TextSize=18]"&naam.SubString2(0,naam.IndexOf(" - "))&"[/TextSize]" BB.Text=BB.Text&CRLF&"[TextSize=11]"&naam.SubString2(naam.IndexOf(" - ")+3,naam.Length)&"[/TextSize]" But did not succeed. Can someone help? Kind regards, André
Hi, I have a string: B4X: Dim Naam as String = "Jan Jaap - Hoofdstraat 1 Amsterdam" I need to put this on a label in 2 lines, so B4X: Dim lblNaam as label lblNaam.Initialize lblNaam.text = Naam.Replace(" - ",CRLF) This works fine, but I want the first line Size 18 and the second line Size 12. How can I do this? I tried something like this: B4X: Dim BB As BBCodeView BB.Initialize("","") BB.Text=naam'.Replace(" - ",CRLF) BB.Text="[TextSize=18]"&naam.SubString2(0,naam.IndexOf(" - "))&"[/TextSize]" BB.Text=BB.Text&CRLF&"[TextSize=11]"&naam.SubString2(naam.IndexOf(" - ")+3,naam.Length)&"[/TextSize]" But did not succeed. Can someone help? Kind regards, André
B Brian Dean Well-Known Member Licensed User Longtime User Nov 1, 2022 #2 I have not tried this myself, but have you looked at CSBuilder.RelativeSize? Edit : I have tried it now : B4X: lblTest.Text = cs.Append("This is large").RelativeSize(0.5).Append(Chr(10) & "and this is small").PopAll Last edited: Nov 1, 2022 Upvote 0
I have not tried this myself, but have you looked at CSBuilder.RelativeSize? Edit : I have tried it now : B4X: lblTest.Text = cs.Append("This is large").RelativeSize(0.5).Append(Chr(10) & "and this is small").PopAll
M Mahares Expert Licensed User Longtime User Nov 1, 2022 #3 AHilberink said: But did not succeed. Click to expand... Here is one way to do it with CSBuilder: B4X: Dim Naam As String = "Jan Jaap - Hoofdstraat 1 Amsterdam" Dim cs As CSBuilder Dim s() As String = Regex.Split(" - ", Naam) cs.Initialize.Size(18).Append(s(0)).Pop.Append(CRLF).Size(12).Append(s(1)).PopAll Label1.Text = cs Upvote 0
AHilberink said: But did not succeed. Click to expand... Here is one way to do it with CSBuilder: B4X: Dim Naam As String = "Jan Jaap - Hoofdstraat 1 Amsterdam" Dim cs As CSBuilder Dim s() As String = Regex.Split(" - ", Naam) cs.Initialize.Size(18).Append(s(0)).Pop.Append(CRLF).Size(12).Append(s(1)).PopAll Label1.Text = cs
AHilberink Active Member Licensed User Longtime User Nov 1, 2022 #4 Thanks you both for your reply. Upvote 0