view ServerMonitor/Forms/QuickHelpForm.cs @ 10:9e77c0dccb66

Add update checker
author Brad Greco <brad@bgreco.net>
date Mon, 08 Apr 2019 21:31:03 -0400
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();
        }
    }
}