S
smith
It's a time saver to "bind" .Net enums to list and comboboxes and all the
samples out there seem to use GetNames and GetValues pretty interchangeably.
So I was wondering what the logic is to the System.Drawing.RotateFlipType
enumeration.
GetNames and GetValues results don't seem to synch up and binding to
GetValues seems to create duplicates of some elements while"losing" others,
and I haven't seen any mention of why that might be.
To see it just drop a couple of tall listboxes on a form and in the load
add:
ListBox1.DataSource = System.Enum.GetNames(GetType(RotateFlipType))
ListBox2.DataSource = System.Enum.GetValues(GetType(RotateFlipType))
Or dump the same to Output:
Dim arValues as String() = System.Enum.GetValues(GetType(RotateFlipType))
Dim arValues As RotateFlipType() =
System.Enum.GetValues(GetType(RotateFlipType))
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine(arNames(i) & vbTab & arValues(i).ToString)
Next
yields:
Rotate180FlipXY RotateNoneFlipNone
RotateNoneFlipNone RotateNoneFlipNone
Rotate90FlipNone Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNone RotateNoneFlipXY
RotateNoneFlipXY RotateNoneFlipXY
Rotate270FlipNone Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX
it's not that there's no one to one relation, but that GetValues returns the
odd duplcate text values. Is it just something about this particular enum
or is this logical and do others that I've not seen yet also do this?
Just wonderin'
smith
kirkland, wa
www.smithvoice.com
samples out there seem to use GetNames and GetValues pretty interchangeably.
So I was wondering what the logic is to the System.Drawing.RotateFlipType
enumeration.
GetNames and GetValues results don't seem to synch up and binding to
GetValues seems to create duplicates of some elements while"losing" others,
and I haven't seen any mention of why that might be.
To see it just drop a couple of tall listboxes on a form and in the load
add:
ListBox1.DataSource = System.Enum.GetNames(GetType(RotateFlipType))
ListBox2.DataSource = System.Enum.GetValues(GetType(RotateFlipType))
Or dump the same to Output:
Dim arValues as String() = System.Enum.GetValues(GetType(RotateFlipType))
Dim arValues As RotateFlipType() =
System.Enum.GetValues(GetType(RotateFlipType))
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine(arNames(i) & vbTab & arValues(i).ToString)
Next
yields:
Rotate180FlipXY RotateNoneFlipNone
RotateNoneFlipNone RotateNoneFlipNone
Rotate90FlipNone Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNone RotateNoneFlipXY
RotateNoneFlipXY RotateNoneFlipXY
Rotate270FlipNone Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX
it's not that there's no one to one relation, but that GetValues returns the
odd duplcate text values. Is it just something about this particular enum
or is this logical and do others that I've not seen yet also do this?
Just wonderin'
smith
kirkland, wa
www.smithvoice.com