private Image GetTrayToolTipIcon(int icon) { Image dispIcon = null; switch (icon) { case (int)ToolTipIcon.Warning: case (int)MessageBoxIcon.Warning: dispIcon = ImageProvider.GetUser32Icon(User32Icon.Warning, true); break; case (int)ToolTipIcon.Error: case (int)MessageBoxIcon.Error: dispIcon = ImageProvider.GetUser32Icon(User32Icon.Error, true); break; case (int)ToolTipIcon.Info: case (int)MessageBoxIcon.Information: dispIcon = ImageProvider.GetUser32Icon(User32Icon.Information, true); break; default: dispIcon = ImageProvider.ApplicationIconLarge; break; } return(dispIcon); }
public FileTaskErrorReport(Dictionary <string, string> errorMap, string title, string message) { InitializeComponent(); SetTitle(title); lblDesc.Text = message; pbWarn.Image = ImageProvider.GetUser32Icon(User32Icon.Warning, true); tvReports.Nodes.Clear(); foreach (KeyValuePair <string, string> kvp in errorMap) { TreeNode tnPath = new TreeNode(kvp.Key); tnPath.NodeFont = ThemeManager.NormalBoldFont; TreeNode tnError = new TreeNode(kvp.Value); tnError.NodeFont = ThemeManager.NormalFont; tnPath.Nodes.Add(tnError); tvReports.Nodes.Add(tnPath); } tvReports.ExpandAll(); int treeHeight = 2 * errorMap.Count * tvReports.ItemHeight + SystemInformation.HorizontalScrollBarHeight; this.Height = tvReports.Top + treeHeight + 30; }
private void UpdateIcon() { if (_isAboutBox) { pbImage.Image = ImageProvider.GetAppIcon(true).ToBitmap(); pbImage.Size = pbImage.Image.Size; pbImage.Visible = true; SystemSounds.Asterisk.Play(); } else { switch (icon) { case MessageBoxIcon.Warning: pbImage.Image = ImageProvider.GetUser32Icon(User32Icon.Warning, true); pbImage.Size = pbImage.Image.Size; pbImage.Visible = true; SystemSounds.Exclamation.Play(); break; case MessageBoxIcon.Error: pbImage.Image = ImageProvider.GetUser32Icon(User32Icon.Error, true); pbImage.Size = pbImage.Image.Size; pbImage.Visible = true; SystemSounds.Hand.Play(); break; case MessageBoxIcon.Question: pbImage.Image = ImageProvider.GetUser32Icon(User32Icon.Question, true); pbImage.Size = pbImage.Image.Size; pbImage.Visible = true; SystemSounds.Question.Play(); break; case MessageBoxIcon.Information: pbImage.Image = ImageProvider.GetUser32Icon(User32Icon.Information, true); pbImage.Size = pbImage.Image.Size; pbImage.Visible = true; SystemSounds.Asterisk.Play(); break; default: pbImage.Image = null; pbImage.Size = new Size(1, 1); pbImage.Image = null; pbImage.Visible = false; SystemSounds.Beep.Play(); break; } } }