Android Question csbuilder and pictures

zorino

New Member
Hi Guys,

It is not clear to me how to deal with pictures with CSbuilder and text above the image and below the image.
Pictures are horizontal or vertical of different sizes (without knowing them) and orientations.


B4X:
    Dim f As Float = 100%x / 100%y
    Dim t As String = "image.jpg"
    Dim cs As CSBuilder

    cs.Initialize
    cs.Append("The picture is crippled".Append(CRLF)
    
   [B] 'cs.Image(LoadBitmapResize(File.DirRootExternal & "/Pictures", t, 80%x, 80%y*f, False), 80%x, 80%y*f, False).Append(CRLF)
    cs.Image(LoadBitmap(File.DirRootExternal & "/Pictures", t), 300dip, 300dip, True).Append(CRLF)
[/B]
    cs.Append("Where do I make a mistake?".Append(CRLF)
    cs.PopAll
 

teddybear

Well-Known Member
Licensed User
No Guys, my question is how to load image into cs with the aspect ratio maintained?
cs.Image(LoadBitmap(File.DirAssets, yourpic), width, height True)
It will keep the aspect ratio(width x height) after loaded image into cs. what is the problem with it?
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?

see:
xui.LoadBitmapResize(File.DirAssets, "support.png", w, h, True)
B4X:
    Label2.SetColorAndBorder(xui.Color_White, 1dip, xui.Color_DarkGray, 10dip)
   
    Dim w As Int = DipToCurrent(Label2.Width * .50)
    Dim h As Int = DipToCurrent(Label2.Height * .50)
   
    Dim cs As CSBuilder
    cs.Initialize
    cs.Alignment("ALIGN_CENTER")
    cs.Append("Call Center")
    cs.Append(CRLF)
    cs.Image(xui.LoadBitmapResize(File.DirAssets, "support.png", w, h, True), w, h, True)
    cs.Append(CRLF)
    cs.Append("Support")
    cs.PopAll
    Label2.Text = cs

1659457486493.png
 
Upvote 0
Top