Hi have an array of Panels.
I am using the following code to change the Color of the Panel.
How do I change the BorderColor of the Panel?B4X:calPanels(pnlNumber).Color = Colors.Cyan
Dim cdPanel As ColorDrawable
cdPanel.Initialize2(Colors.Red, 0, Colors.Black, 1)
calPanels(pnlNumber).Background = cdPanel
Thanks, but that changes the Background color.Hi,
B4X:Dim cdPanel As ColorDrawable cdPanel.Initialize2(Colors.Red, 0, Colors.Black, 1) calPanels(pnlNumber).Background = cdPanel
Dim cv as Canvas
cv.Initialize(calPanels(pnlNumber))
cv.DrawColor(Colors.Red) 'Background
Dim dstRect as Rect
dstRect.Initialize(0,0,calPanels(pnlNumber).Width, calPanels(pnlNumber).Height))
cv.DrawRect(dstRect, Colors.Green, False, 4dip) 'Border color and width
Many thanks - works greatThis should work (for non-rounded borders)
B4X:Dim cv as Canvas cv.Initialize(calPanels(pnlNumber)) cv.DrawColor(Colors.Red) 'Background Dim dstRect as Rect dstRect.Initialize(0,0,calPanels(pnlNumber).Width, calPanels(pnlNumber).Height)) cv.DrawRect(dstRect, Colors.Green, False, 4dip) 'Border color and width
There is nothing wrong with the code. It changes background colour and the border colour. If you want to only change the border colour, have the first parameter to Initialize2 set to the same colour as your panel background (you know what the colour of your background is), and only change the fourth parameter which is the colour of the border. You can set the border width and border corner radius as well.Thanks, but that changes the Background color.
I only want to change the border color.