private void SafelyAddIcon(string fullFileName) { try { if (!imageListUnits.Images.ContainsKey(fullFileName)) { imageListUnits.Images.Add(fullFileName, ExtractIcon.GetIconForFilename(fullFileName, true).ToBitmap()); } } catch { } }
public MainForm() { // Force use of Segou UI Font in Vista and above // But this makes a mess of the layouts when they are autoscaled !!! //if (SystemFonts.MessageBoxFont.Size >= 9) // Font = SystemFonts.MessageBoxFont; InitializeComponent(); Icon icon = ExtractIcon.GetIconForFilename(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer), true); imageListUnits.Images.Add("MyComputer", icon.ToBitmap()); versionNumberToolStripMenuItem.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString(); }