Hi all,
I don't understand different to parameter and variabled ,how to solve this problem.
I don't understand different to parameter and variabled ,how to solve this problem.
B4X:
Private Sub DrawRoundedRect(cvs As B4XCanvas, Rect As B4XRect, CornerRadius As Float, Color As Int, Filled As Boolean, StrokeWidth As Float)
' สร้าง Path สำหรับวาด Rectangle ที่มีมุมโค้ง
Dim p As B4XPath
' จุดต่างๆของสี่เหลี่ยม
Dim Left As Float = Rect.Left
Dim Top As Float = Rect.Top
Dim Right As Float = Rect.Right
Dim Bottom As Float = Rect.Bottom
Dim Width As Float = Rect.Width
Dim Height As Float = Rect.Height
' กำหนดค่า Corner radius ให้ไม่เกินครึ่งหนึ่งของความกว้างหรือความสูง
CornerRadius = Min(CornerRadius, Min(Width / 2, Height / 2))
' สร้าง Path
p.Initialize(Left + CornerRadius, Top)
' ด้านบน
p.LineTo(Right - CornerRadius, Top)
' มุมขวาบน
p.LineTo(Right, Top + CornerRadius)
' ด้านขวา
p.LineTo(Right, Bottom - CornerRadius)
' มุมขวาล่าง
p.LineTo(Right - CornerRadius, Bottom)
' ด้านล่าง
p.LineTo(Left + CornerRadius, Bottom)
' มุมซ้ายล่าง
p.LineTo(Left, Bottom - CornerRadius)
' ด้านซ้าย
p.LineTo(Left, Top + CornerRadius)
' มุมซ้ายบน
p.LineTo(Left + CornerRadius, Top)
' วาด Path
cvs.DrawPath(p, Color, Filled, StrokeWidth)
End Sub