.net - Enums of colors -


my idea switch between colors, don't have use multiple pens can declare one.

i'm not sure have understood how enums work, please correct me:

type colortype =   | red = color.red   | green = color.green   | blue = color.blue 

and wish use in:

let p = new pen(colortype.[index]) g.drawrectangle(p, 0, 0, 10, 10) 

where index int variable (0 2) i'll use switch colors. problem can't declare enum, color not accepted. possible solutions?

to access colors index, put them in array:

let colors =   [|     color.red     color.green     color.blue   |]  let p = new pen(colors.[index]) g.drawrectangle(p, 0, 0, 10, 10) 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -