Help with FillPolygon

Discussion in 'Questions (Windows Mobile)' started by Benh, Jun 10, 2009.

  1. Benh

    Benh Member Licensed User

    Could some kind person please tell me where I am going wrong with this code?

    Many Thanks, Ben

    PHP:
    Sub Globals
       
    'Declare the global variables here.
    Dim Points(3,2) As Int32
    End Sub

    Sub App_Start
       Form1.Show
    End Sub

    Sub Button1_Click
       drwPoly.New1("Form1","True")
         myBrush.New1(cRed)
         Points() = Array((50,50),(100,100),(150,150))
         drwPoly.FillPolygon(myBrush.Value,Points())
    End Sub
     
  2. klaus

    klaus Expert Licensed User

    This code works:
    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Globals[/SIZE][/FONT]
    [/SIZE][/
    FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]'Declare the global variables here.[/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/
    FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]  Dim[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Points([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]3[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]2[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Int32[/SIZE][/FONT]
    [/SIZE][/
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    [
    FONT=Courier New][/FONT
    [
    FONT=Courier New][SIZE=2][COLOR=#0000ff]
    [SIZE=
    2][FONT=Courier New][COLOR=#0000ff][SIZE=2][FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]App_Start[/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New][COLOR=red]  Form1.ForeLayer=[/COLOR][/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=red]True[/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/
    FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]  Form1.Show[/SIZE][/FONT]
    [/SIZE][/
    FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
    [
    FONT=Courier New][/FONT
    [
    FONT=Courier New][SIZE=2][COLOR=#0000ff]
    [SIZE=
    2][FONT=Courier New][COLOR=#0000ff][SIZE=2][FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][/SIZE][/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Button1_Click [/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New]  drwPoly.New1([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"Form1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]True[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) [/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New]  myBrush.New1([/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]cRed[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][SIZE=2][FONT=Courier New][SIZE=2]) [/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New][COLOR=red]  Points() = [/COLOR][/FONT][/SIZE][/SIZE][COLOR=red][FONT=Courier New][SIZE=2][SIZE=2][SIZE=2]Array[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2](([/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]50[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2],[/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]50[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2]),([/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]100[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2],[/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]50[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2]),([/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]150[/SIZE][/SIZE][/SIZE][SIZE=2][SIZE=2],[/SIZE][/SIZE][SIZE=2][SIZE=2][SIZE=2]150[/SIZE][/SIZE][/SIZE][/FONT][/COLOR][SIZE=2][SIZE=2][FONT=Courier New][COLOR=red]))[/COLOR] [/FONT][/SIZE]
    [
    FONT=Courier New][SIZE=2]  drwPoly.FillPolygon(myBrush.Value,Points()) [/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New][COLOR=red]  Form1.Refresh[/COLOR][/FONT][/SIZE]
    [/SIZE][SIZE=
    2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff][SIZE=2][FONT=Courier New][COLOR=#0000ff]End Sub[/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE]
    You must:
    - add Form1.ForeLayer=True because you want to draw on the forelayer
    - change Points() = Array((50,50),(100,100),(150,150)) to
    Points() = Array((50,50),(100,50),(150,150))
    because your 3 points lay on a line wich is not considered a polygon.
    - add Form1.Refresh to refresh the form

    Best regards.
     
  3. Benh

    Benh Member Licensed User

    Thank you Klaus.

    I am very grateful to you.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice