mrossen Active Member Licensed User Longtime User Jul 11, 2015 #1 HI, I am drawing 2 lines on a panel like this, B4X: Dim CanvasHolder As Canvas CanvasHolder.Initialize(Panel2) CanvasHolder.DrawLine(10, 10, 10, Panel2.Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.DrawLine(10, Panel2.Height - 20, Panel2.Width - 20, Panel2.Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.Refresh I would like to Draw the 2 line on another 10 panels. Is there a way to do tihs smart without duplicating the code 10 times. Another problem is if I ex. have a button on the panel with the lines, the refresh redraws the button so i appars 2 times. Is there a way to prevent this or do I have to but the button on another panel, Thanks Mogens
HI, I am drawing 2 lines on a panel like this, B4X: Dim CanvasHolder As Canvas CanvasHolder.Initialize(Panel2) CanvasHolder.DrawLine(10, 10, 10, Panel2.Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.DrawLine(10, Panel2.Height - 20, Panel2.Width - 20, Panel2.Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.Refresh I would like to Draw the 2 line on another 10 panels. Is there a way to do tihs smart without duplicating the code 10 times. Another problem is if I ex. have a button on the panel with the lines, the refresh redraws the button so i appars 2 times. Is there a way to prevent this or do I have to but the button on another panel, Thanks Mogens
Erel B4X founder Staff member Licensed User Longtime User Jul 12, 2015 #2 B4X: Sub DrawLinesOnPanel(pnl As Panel) Dim CanvasHolder AsCanvas CanvasHolder.Initialize(pnl ) CanvasHolder.DrawLine(10, 10, 10, pnl .Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.DrawLine(10, pnl .Height - 20, pnl .Width - 20, pnl .Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.Refresh End Sub Add another panel to each of the panels and draw on the added panel. Upvote 0
B4X: Sub DrawLinesOnPanel(pnl As Panel) Dim CanvasHolder AsCanvas CanvasHolder.Initialize(pnl ) CanvasHolder.DrawLine(10, 10, 10, pnl .Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.DrawLine(10, pnl .Height - 20, pnl .Width - 20, pnl .Height - 20, Colors.RGB(127,176,0), 1) CanvasHolder.Refresh End Sub Add another panel to each of the panels and draw on the added panel.