view ServerMonitor/Forms/QuickHelpForm.cs @ 2:453ecc1ed9ea

Disk space check
author Brad Greco <brad@bgreco.net>
date Sun, 06 Jan 2019 20:49:08 -0500
parents 3e1a2131f897
children 2db36ab759de
line wrap: on
line source

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();
        }
    }
}