
The post Use reflection to easily list the values defined by an enumerated type in C# shows one way to list the values in an enumeration. This example uses that technique in the following code to enumerate the HatchStyle values.
// Display the names and samples of the HatchStyle values. private void Form1_Load(object sender, EventArgs e) { // Get a list of the HatchStyles. List<HatchStyle> hatch_styles = GetEnumValues<HatchStyle>(); foreach (HatchStyle hatch_style in hatch_styles) { DisplayHatchStyle(hatch_style); } }
For each HatchStyle, this code calls the DisplayHatchStyle method. That method displays the HatchStyle names and samples in a Panel and adds the Panel to the program’s FlowLayoutPanel. See the example Display images of the cursors available in C# for details about that technique.



Good stuff. Think you have put BM_WID where you meant BM_HGT at lines 81 & 95.
Hi Oliver,
You’re right. By coincidence, the program was only copying part of the image into a different image and displaying the image in a smaller PictureBox. Although the bitmap had the incorrect size, you didn’t notice because it was bigger than necessary.
It’s still nice to fix these things. Thanks for pointing this out!