FrmResize.cs
1.3 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CodeSplicing
{
public partial class FrmResize : Form
{
public Rectangle Rect { private set; get; }
public FrmResize()
{
InitializeComponent();
}
public FrmResize(Size size) : this()
{
NudX.Enabled = false;
NudY.Enabled = false;
NudW.Value = size.Width;
NudH.Value = size.Height;
}
public FrmResize(Rectangle rect) : this()
{
NudX.Value = rect.X < 0 ? 0 : rect.X;
NudY.Value = rect.Y < 0 ? 0 : rect.Y;
NudW.Value = rect.Width <= 0 ? 1 : rect.Width;
NudH.Value = rect.Height <= 0 ? 1 : rect.Height;
}
private void BtnOK_Click(object sender, EventArgs e)
{
Rect = new Rectangle(Convert.ToInt32(NudX.Value), Convert.ToInt32(NudY.Value), Convert.ToInt32(NudW.Value), Convert.ToInt32(NudH.Value));
DialogResult = DialogResult.OK;
}
private void FrmResize_Load(object sender, EventArgs e)
{
Asa.Common.Language.SetLanguage(this);
}
}
}