If you want to draw multiple points, you should use

1
2
3
4
5
6
7
8
9
10
11
12
  let form = 
    let temp = new Form()
    temp.Resize.Add(fun _ -> temp.Invalidate())
    let mutable x = 0
    let mutable y = 0
    let hexPoint = Hex (x, y)
    temp.Paint.Add(fun e -> e.Graphics.DrawPolygon(Pens.Red, hexPoint))
    for i = 1 to 10 do
      x <- x + 80
      let tmpHexpoint = Hex (x, y) //temporary variable
      temp.Paint.Add(fun e -> e.Graphics.DrawPolygon(Pens.Red, tmpHexpoint))
    temp

By default, variables are not mutables. If you wanted to make hexpoint variable, you should have defined it with ref

1
let hexpoint = ref <| Hex(x,y)

But by doing so, your drawing would have failed because all polygons would refer to the same set of value (i.e. the ones in the last value assigned to hexpoint)

Hope this helps

By on 10/24/2008 1:40 PM ()

Thank-you!

By on 10/24/2008 4:08 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper