Example #1
0
        public LvFont() : base()
        {
            DoubleBuffered        = true;
            fc                    = new FontCollection();
            Sorting               = SortOrder.Ascending;
            this.OwnerDraw        = true;
            this.TileSize         = DefaultTileSize;
            this.ContextMenuStrip = new ContextMenuStrip();
            this.ContextMenuStrip.Items.AddRange(new ToolStripItem[] {
                new ToolStripFontItem("Detail", null, delegate { base.View = View.Details; }),
                new ToolStripFontItem("Tile", null, delegate { View = View.Tile; Invalidate(); }),
                new ToolStripFontItem("Icon", null, delegate { View = View.List; Invalidate(); }),
                new ToolStripFontItem("Large", null, delegate { View = View.LargeIcon; Invalidate(); }),
                new ToolStripFontItem("Small", null, delegate { View = View.SmallIcon; Invalidate(); }),
            });
            List <ListViewItem> lvitems = new List <ListViewItem>();

            foreach (FontFamily x in fc)
            {
                lvitems.Add(new ListViewItem(new string[] { x.Name, fc.ListStyles(x) }));
            }
            Items.AddRange(lvitems.ToArray());
            lvitems.Clear();
            lvitems = null;
        }