1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// Les paramètres
const int glyph_count = 256;
const float glyph_size = 72.0f;
const string font_name = "Wingdings";
// Les objets
Font font = new Font(font_name, glyph_size);
ImageList imgl = new ImageList();
imgl.ImageSize = new Size(font.Height, font.Height);
listView1.LargeImageList = imgl;
listView1.View = View.LargeIcon;
listView1.MultiSelect = false;
for (int i = 0; i < glyph_count; i++)
{
Bitmap bmp = new Bitmap(imgl.ImageSize.Width, imgl.ImageSize.Height);
Graphics g = Graphics.FromImage(bmp);
g.DrawString(new String((char)i, 1), font, Brushes.Black, Rectangle.FromLTRB(0, 0, bmp.Width, bmp.Height));
g.Dispose();
imgl.Images.Add(bmp); // Faut libérer les ressources à la fin
listView1.Items.Add(i.ToString(), i);
} |
Partager