ABaseControl.cs
3.1 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using System.Drawing.Drawing2D;
using Acc.ImageBox;
namespace AccAOI.control
{
public partial class ABaseControl : Form
{
public ABaseControl()
{
InitializeComponent();
}
public string TitleName
{
get { return panControl.Text; }
set { panControl.Text = value; }
}
protected object UpdateLock = "";
public Image GetImg()
{
return FrmAoiSetting.BaseImg;
}
internal bool IsShowOk = false;
/// <summary>
/// 区域类型,1=矩形,2=圆形
/// </summary>
public int AreaType = 1;
/// <summary>
/// 显示的图片类型,1=原图,2=效果图
/// </summary>
public int ShowImageType = 2;
/// <summary>
/// 区域信息
/// </summary>
protected GraphicsPath currPath = null;
public AccImageBox BImageBox;
public AoiMethod AoiInfo;
/// <summary>
/// 未处理的小图
/// </summary>
protected Image CutImage = null;
public void SetCurrPath(GraphicsPath path, bool isUpdate = true)
{
this.currPath = path;
if (isUpdate)
{
UpdateImage();
}
}
public virtual void UpdateImage()
{
}
public virtual void ShowAoiInfo()
{
IsShowOk = true;
}
public virtual AoiMethod GetAoiInfo()
{
return AoiInfo;
}
private void btnSetArea_Click(object sender, EventArgs e)
{
if (AreaType.Equals(1))
{
AreaType = 2;
panAreaSet.Text = "区域设置 - 椭圆";
btnSetArea.Text = "矩形";
BImageBox.SelectionMode = ImageBoxSelectionMode.Eclipse;
}
else
{
AreaType = 1;
panAreaSet.Text = "区域设置 - 矩形";
btnSetArea.Text = "椭圆";
BImageBox.SelectionMode = ImageBoxSelectionMode.Rectangle;
}
}
private void btnClearArea_Click(object sender, EventArgs e)
{
// this.BImageBox.CleearArea();
this.aoiImage.Image = null;
BImageBox.SelectNone();
}
private void btnImgType_Click(object sender, EventArgs e)
{
if (btnImgType.Text.Equals("原图")) {
ShowImageType = 1;
btnImgType.Text = "效果图";
panAreaImage.Text = "区域图 - 原图";
}
else
{
ShowImageType = 2;
btnImgType.Text = "原图";
panAreaImage.Text = "区域图像 - 效果图";
}
UpdateImage();
}
}
}