-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfrmScreens.cs
96 lines (88 loc) · 4.18 KB
/
frmScreens.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WinSize4
{
public partial class frmScreens : Form
{
public List<ClsScreenList> _screenList = new List<ClsScreenList>();
public List<ClsScreenList> _returnScreenList { get; set; }
int _boundsWidth;
int _boundsHeight;
bool _primary;
public frmScreens(List<ClsScreenList> Form1ScreenList, int _boundsWidth, int _boundsHeight, bool _primary)
{
InitializeComponent();
this._screenList = Form1ScreenList;
this._boundsWidth = _boundsWidth;
this._boundsHeight = _boundsHeight;
this._primary = _primary;
}
private void Screens_Load(object sender, EventArgs e)
{
listView1.Items.Clear();
string[] row;
int Index = 0;
foreach (ClsScreenList Scr in this._screenList)
{
if (Scr.Primary)
row = new string[] { Scr.BoundsWidth.ToString(), Scr.BoundsHeight.ToString(), "Yes" };
else
row = new string[] { Scr.BoundsWidth.ToString(), Scr.BoundsHeight.ToString(), "No" };
var listViewItem = new ListViewItem(row);
if (! Scr.Present)
{
listViewItem.ForeColor = System.Drawing.Color.Silver;
listViewItem.SubItems[1].ForeColor = Color.Silver;
listViewItem.SubItems[2].ForeColor = Color.Silver;
listViewItem.UseItemStyleForSubItems = false;
}
listView1.Items.Add(listViewItem);
if (Scr.BoundsWidth == _boundsWidth && Scr.BoundsHeight == _boundsHeight && Scr.Primary == _primary)
Index = listView1.Items.Count - 1;
}
listView1.Items[Index].Selected = true;
listView1.Select();
}
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count > 0)
{
tbFullWidth.Text = this._screenList[listView1.SelectedItems[0].Index].BoundsWidth.ToString();
tbFullHeight.Text = this._screenList[listView1.SelectedItems[0].Index].BoundsHeight.ToString();
tbWorkingAreaWidth.Text = this._screenList[listView1.SelectedItems[0].Index].WorkingAreaWidth.ToString();
tbWorkingAreaHeight.Text = this._screenList[listView1.SelectedItems[0].Index].WorkingAreaHeight.ToString();
tbCustomLeft.Text = this._screenList[listView1.SelectedItems[0].Index].CustomLeft.ToString();
tbCustomTop.Text = this._screenList[listView1.SelectedItems[0].Index].CustomTop.ToString();
tbCustomWidth.Text = this._screenList[listView1.SelectedItems[0].Index].CustomWidth.ToString();
tbCustomHeight.Text = this._screenList[listView1.SelectedItems[0].Index].CustomHeight.ToString();
}
}
private void butOK_Click(object sender, EventArgs e)
{
this._returnScreenList = this._screenList;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void tbCustomLeft_TextChanged(object sender, EventArgs e)
{
if (int.TryParse(tbCustomLeft.Text, out int number))
this._screenList[listView1.SelectedItems[0].Index].CustomLeft = number;
}
private void tbCustomTop_TextChanged(object sender, EventArgs e)
{
if (int.TryParse(tbCustomTop.Text, out int number))
this._screenList[listView1.SelectedItems[0].Index].CustomTop = number;
}
private void tbCustomWidth_TextChanged_1(object sender, EventArgs e)
{
if (int.TryParse(tbCustomWidth.Text, out int number))
this._screenList[listView1.SelectedItems[0].Index].CustomWidth = number;
}
private void tbCustomHeight_TextChanged_1(object sender, EventArgs e)
{
if (int.TryParse(tbCustomHeight.Text, out int number))
this._screenList[listView1.SelectedItems[0].Index].CustomHeight = number;
}
}
}