diff ServerMonitor/Forms/QuickHelpForm.cs @ 0:3e1a2131f897

Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
author Brad Greco <brad@bgreco.net>
date Mon, 31 Dec 2018 18:32:14 -0500
parents
children 2db36ab759de
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ServerMonitor/Forms/QuickHelpForm.cs	Mon Dec 31 18:32:14 2018 -0500
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ServerMonitorApp
+{
+    public partial class QuickHelpForm : Form
+    {
+        private string Rtf;
+
+        public QuickHelpForm()
+        {
+            InitializeComponent();
+        }
+
+        public QuickHelpForm(string rtf)
+        {
+            InitializeComponent();
+            Rtf = rtf;
+        }
+
+        private void QuickHelpForm_Load(object sender, EventArgs e)
+        {
+            (Owner as CheckForm).HelpLocationChanged += Owner_HelpPositionChanged;
+            HelpTextBox.ContentsResized += HelpTextBox_ContentsResized; // Causes form to resize after Rtf is assigned
+            HelpTextBox.Rtf = Rtf;
+        }
+
+        private void HelpTextBox_ContentsResized(object sender, ContentsResizedEventArgs e)
+        {
+            Height = e.NewRectangle.Height + 12;
+        }
+
+        private void Owner_HelpPositionChanged(object sender, HelpLocationChangedEventArgs e)
+        {
+            Point location = e.HelpLocation;
+            location.Offset(24, 0);
+            Location = location;
+        }
+
+        private void Control_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Escape)
+                Close();
+        }
+
+        private void Control_Click(object sender, EventArgs e)
+        {
+            Close();
+        }
+    }
+}