private void browseIcon_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Select Portable Network Graphics *.png"; ofd.Filter = "Portable Network Graphics Files (*.png)|*.png"; ofd.ShowDialog(); try { Bitmap bmp = new Bitmap(BubbleIconPath.Text); if (bmp.Width == 80 && bmp.Height == 80) { BubbleIcon.Dispose(); BubbleIcon.Image = bmp; BubbleIconPath.Text = ofd.FileName; } else { MessageBox.Show("Invalid Icon file (not 80x80)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { MessageBox.Show("Invalid PNG File.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BubbleIconPath_TextChanged(object sender, EventArgs e) { try { Bitmap bmp = new Bitmap(BubbleIconPath.Text); if (bmp.Width == 80 && bmp.Height == 80) { BubbleIcon.Dispose(); BubbleIcon.Image = bmp; } } catch (Exception) { }; }