|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.ComponentModel; |
| 4 | +using System.Data; |
| 5 | +using System.Drawing; |
| 6 | +using System.Linq; |
| 7 | +using System.Text; |
| 8 | +using System.Threading.Tasks; |
| 9 | +using System.Windows.Forms; |
| 10 | + |
| 11 | +namespace NetStalker.Forms.Information |
| 12 | +{ |
| 13 | + public partial class MessageBoxForm : Form |
| 14 | + { |
| 15 | + public MessageBoxForm(string Title, string Message, MessageBoxIcon Icon, MessageBoxButtons Buttons) |
| 16 | + { |
| 17 | + InitializeComponent(); |
| 18 | + |
| 19 | + this.Text = Title; |
| 20 | + MessageControl.Text = Message; |
| 21 | + |
| 22 | + switch (Icon) |
| 23 | + { |
| 24 | + case MessageBoxIcon.None: |
| 25 | + IconControl.Image = null; |
| 26 | + break; |
| 27 | + case MessageBoxIcon icon when (icon == MessageBoxIcon.Hand |
| 28 | + || icon == MessageBoxIcon.Stop |
| 29 | + || icon == MessageBoxIcon.Error): |
| 30 | + IconControl.Image = MessageIcons.Images[0]; |
| 31 | + break; |
| 32 | + case MessageBoxIcon.Question: |
| 33 | + IconControl.Image = MessageIcons.Images[2]; |
| 34 | + break; |
| 35 | + case MessageBoxIcon icon when (icon == MessageBoxIcon.Exclamation || |
| 36 | + icon == MessageBoxIcon.Warning): |
| 37 | + IconControl.Image = MessageIcons.Images[1]; |
| 38 | + break; |
| 39 | + case MessageBoxIcon icon when (icon == MessageBoxIcon.Information || |
| 40 | + icon == MessageBoxIcon.Asterisk): |
| 41 | + IconControl.Image = MessageIcons.Images[3]; |
| 42 | + break; |
| 43 | + default: |
| 44 | + IconControl.Image = MessageIcons.Images[4]; //Success |
| 45 | + break; |
| 46 | + } |
| 47 | + |
| 48 | + if (Buttons == MessageBoxButtons.OKCancel) |
| 49 | + { |
| 50 | + CancelBtn.Visible = true; |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | +} |
0 commit comments