-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSizeForm.cs
58 lines (50 loc) · 1.89 KB
/
SizeForm.cs
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
57
58
using DmLib.Window;
using OnTopper.Properties;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
using OnTopper.Util;
namespace OnTopper
{
public partial class SizeForm : Form
{
private Process process;
private Rectangle oldRectangle;
public SizeForm()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.LanguageAbbreviation.ToLower());
InitializeComponent();
}
public void ShowDialogAndSetWindowSize(Process p, bool topMost)
{
TopMost = topMost;
process = p;
oldRectangle = Borders.GetWindowRectangle(p);
textBoxX.Text = oldRectangle.X.ToString();
textBoxY.Text = oldRectangle.Y.ToString();
textBoxHeight.Text = (oldRectangle.Height - oldRectangle.Y).ToString();
textBoxWidth.Text = (oldRectangle.Width - oldRectangle.X).ToString();
ShowDialog();
}
private void ButtonApply_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(textBoxHeight.Text) || string.IsNullOrWhiteSpace(textBoxWidth.Text) ||
string.IsNullOrWhiteSpace(textBoxX.Text) || string.IsNullOrWhiteSpace(textBoxY.Text))
{
MessageBox.Show(LocalizedMessageProvider.GetMessage("SET_HEIGHT_WIDTH"),
LocalizedMessageProvider.GetMessage("ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
Borders.EditWindow(process, int.Parse(textBoxX.Text), int.Parse(textBoxY.Text),
int.Parse(textBoxHeight.Text), int.Parse(textBoxWidth.Text));
Close();
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
Close();
}
}
}