iOS Question Drawing line in canvas

Discussion in 'iOS Questions' started by mrossen, Jul 11, 2015.

  1. mrossen

    mrossen Active Member Licensed User

    HI,

    I am drawing 2 lines on a panel like this,

    Code:
    Dim CanvasHolder As Canvas
        CanvasHolder.Initialize(Panel2)
        CanvasHolder.DrawLine(
    101010, Panel2.Height - 20Colors.RGB(127,176,0), 1)   
        CanvasHolder.DrawLine(
    10, Panel2.Height - 20, Panel2.Width - 20, Panel2.Height - 20Colors.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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Sub DrawLinesOnPanel(pnl As Panel)
     
    Dim CanvasHolder AsCanvas
     CanvasHolder.Initialize(pnl )
     CanvasHolder.DrawLine(
    101010, pnl .Height - 20Colors.RGB(127,176,0), 1
     CanvasHolder.DrawLine(
    10, pnl .Height - 20, pnl .Width - 20, pnl .Height - 20Colors.RGB(127,176,0), 1)
     CanvasHolder.Refresh
    End Sub
    Add another panel to each of the panels and draw on the added panel.
     
Loading...