| Line | |
|---|
| 1 | using System;
|
|---|
| 2 | using System.Drawing;
|
|---|
| 3 | using System.Windows.Forms;
|
|---|
| 4 |
|
|---|
| 5 | namespace Common
|
|---|
| 6 | {
|
|---|
| 7 | public class FormEx : Form
|
|---|
| 8 | {
|
|---|
| 9 | public FormEx() : base()
|
|---|
| 10 | {
|
|---|
| 11 | FormClosed += new FormClosedEventHandler(FormEx_FormClosed);
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | protected override void OnLoad(EventArgs e)
|
|---|
| 15 | {
|
|---|
| 16 | base.OnLoad(e);
|
|---|
| 17 | Theme.UseTheme(this);
|
|---|
| 18 | DpiScaling.Apply(this);
|
|---|
| 19 | Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
|---|
| 20 | new FormDimensions().Load(this, Owner);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | private void FormEx_FormClosed(object sender, FormClosedEventArgs e)
|
|---|
| 24 | {
|
|---|
| 25 | new FormDimensions().Save(this);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | protected override bool ProcessDialogKey(Keys keyData)
|
|---|
| 29 | {
|
|---|
| 30 | if (ModifierKeys == Keys.None && keyData == Keys.Escape)
|
|---|
| 31 | {
|
|---|
| 32 | Close();
|
|---|
| 33 | return true;
|
|---|
| 34 | }
|
|---|
| 35 | return base.ProcessDialogKey(keyData);
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.