This repository was archived by the owner on Feb 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm4.cs
More file actions
56 lines (49 loc) · 1.51 KB
/
Copy pathForm4.cs
File metadata and controls
56 lines (49 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Windows.Forms;
namespace PowerCacheOffice
{
public partial class Form4 : Form
{
public string PageName { get; set; }
public Form4(bool isDarkMode, string currentPageName)
{
InitializeComponent();
textBox1.Text = currentPageName;
Program.SortTabIndex(this);
Program.ChangeDarkMode(this, isDarkMode);
if (isDarkMode)
{
this.Icon = Properties.Resources.PowerCacheOfficeLaunchWhite;
}
else
{
this.Icon = Properties.Resources.PowerCacheOfficeLaunchBlack;
}
}
private void Form4_Load(object sender, EventArgs e)
{
textBox1.PreviewKeyDown += (s, eventArgs) =>
{
if (eventArgs.KeyCode == Keys.Enter)
{
PageName = textBox1.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}
};
textBox1.KeyPress += (s, eventArgs) =>
{
if (eventArgs.KeyChar == (char)Keys.Enter || eventArgs.KeyChar == (char)Keys.Escape)
{
eventArgs.Handled = true;
}
};
}
private void button1_Click(object sender, EventArgs e)
{
PageName = textBox1.Text;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}