source: Common/FormEx.cs

Last change on this file was 15, checked in by chronos, 6 months ago
  • Modified: Updated files.
File size: 1023 bytes
Line 
1using System;
2using System.Drawing;
3using System.Windows.Forms;
4
5namespace 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.