Skip to content

Commit 2fefa00

Browse files
committed
Add MessageBoxForm dialog for displaying errors and info messages.
1 parent b1d6fe6 commit 2fefa00

File tree

3 files changed

+2755
-0
lines changed

3 files changed

+2755
-0
lines changed

NetStalker/NetStalker/Forms/Information/MessageBoxForm.Designer.cs

+145
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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

Comments
 (0)