aboutsummaryrefslogtreecommitdiff
path: root/source/ShiftUI/Form/MessageBox.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
committerMichaelTheShifter <[email protected]>2016-07-20 09:40:36 -0400
commitd40fed5ce2bc806a91245adb18039634eac13ed0 (patch)
treef1d7168aee6db109ac2c738ad18c9db667a6ba69 /source/ShiftUI/Form/MessageBox.cs
parentf1856e8ed30ed882229fd3fa2a4038122a5fb441 (diff)
downloadshiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.gz
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.tar.bz2
shiftos-c--d40fed5ce2bc806a91245adb18039634eac13ed0.zip
Move ShiftUI source code to ShiftOS
This'll be a lot easier to work on.
Diffstat (limited to 'source/ShiftUI/Form/MessageBox.cs')
-rw-r--r--source/ShiftUI/Form/MessageBox.cs66
1 files changed, 66 insertions, 0 deletions
diff --git a/source/ShiftUI/Form/MessageBox.cs b/source/ShiftUI/Form/MessageBox.cs
new file mode 100644
index 0000000..aab960a
--- /dev/null
+++ b/source/ShiftUI/Form/MessageBox.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftUI
+{
+ public class MessageBox : Form
+ {
+
+ public static void Show(string message, string title)
+ {
+ var m = new MessageBox(title, message);
+
+ m.TopMost = true;
+ m.ShowDialog();
+ }
+
+ public MessageBox(string title, string message)
+ {
+ var pnlbottom = new FlowLayoutPanel();
+ pnlbottom.Height = 30;
+ pnlbottom.BackColor = Application.CurrentSkin.MessageBox_BottomPanel;
+ var pnltop = new Panel();
+ pnlbottom.Dock = DockStyle.Bottom;
+ pnltop.Dock = DockStyle.Fill;
+ this.Widgets.Add(pnlbottom);
+ pnlbottom.Show();
+ this.Widgets.Add(pnltop);
+ pnltop.Show();
+ var btnok = new Button();
+ btnok.Text = "OK";
+ btnok.AutoSize = true;
+ btnok.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ pnlbottom.Widgets.Add(btnok);
+ btnok.Show();
+ btnok.Click += (s, a) =>
+ {
+ this.Close();
+ };
+ var lblmessage = new Label();
+ lblmessage.Padding = new Padding(25);
+ lblmessage.Text = message;
+ lblmessage.Dock = DockStyle.Fill;
+ pnltop.Widgets.Add(lblmessage);
+ lblmessage.Show();
+ //autosize the form
+ int newheight = 10;
+ for(int i = 0; i < lblmessage.Text.Length; i++)
+ {
+ if ((i % 2) == 0)
+ newheight += 10;
+ }
+ this.MaximumSize = new System.Drawing.Size(500, 200);
+ this.Height = newheight + pnlbottom.Height;
+ this.Load += (o, a) =>
+ {
+ this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
+ this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
+
+ };
+ this.Text = title;
+ }
+ }
+}