Commit 484b1f32 LN

界面修改

1 个父辈 3324a83b
......@@ -15,7 +15,7 @@ namespace AccAOI
public partial class FrmAoiSetting : Asa.Theme.FlatForm
{
private control.ABaseControl aoiControl = null;
private Image Img = null;
public Image Img = null;
private AoiProject Project = null;
public FrmAoiSetting()
{
......
......@@ -24,6 +24,15 @@ namespace AccAOI.control
get { return panControl.Text; }
set { panControl.Text = value; }
}
public Image GetImg()
{
if (this.Parent != null && this.Parent is FrmAoiSetting)
{
return ((FrmAoiSetting)this.Parent).Img;
}
return null;
}
/// <summary>
/// 区域类型,1=矩形,2=圆形
/// </summary>
......@@ -32,14 +41,23 @@ namespace AccAOI.control
/// 区域信息
/// </summary>
public GraphicsPath currPath = null;
public ImageBox BImageBox;
public AoiMethod AoiInfo;
/// <summary>
/// 未处理的小图
/// </summary>
protected Image BaseImage = null;
public void SetImage(Image image)
public void SetCurrPath(GraphicsPath path)
{
this.aoiImage.Image = image;
BaseImage = image;
this.currPath = path;
UpdateImage();
}
public virtual void UpdateImage()
{
}
public virtual void ShowAoiInfo()
{
......
......@@ -101,15 +101,16 @@
// chkwhiteOnBlack
//
this.chkwhiteOnBlack.Inside = false;
this.chkwhiteOnBlack.Location = new System.Drawing.Point(151, 405);
this.chkwhiteOnBlack.Location = new System.Drawing.Point(125, 419);
this.chkwhiteOnBlack.Name = "chkwhiteOnBlack";
this.chkwhiteOnBlack.Size = new System.Drawing.Size(62, 30);
this.chkwhiteOnBlack.TabIndex = 15;
this.chkwhiteOnBlack.CheckedChanged += new Asa.Theme.Event.ValueChanged(this.chkwhiteOnBlack_CheckedChanged);
//
// flatLabel2
//
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(14, 405);
this.flatLabel2.Location = new System.Drawing.Point(12, 419);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(75, 30);
this.flatLabel2.TabIndex = 16;
......
......@@ -23,6 +23,7 @@ namespace AccAOI.control
{
int value = trackBarThresh.Value;
lblthresh.Text = value.ToString();
UpdateImage();
}
private AoiBlobMethod MethodBlob = null;
public override void ShowAoiInfo()
......@@ -74,8 +75,12 @@ namespace AccAOI.control
}
return AoiInfo;
}
private void UpdateImage()
public override void UpdateImage()
{
if (BaseImage == null)
{
return;
}
GetAoiInfo();
Image outImage = null;
List<CvBlob> list = new List<CvBlob>();
......@@ -89,5 +94,10 @@ namespace AccAOI.control
{
UpdateImage();
}
private void chkwhiteOnBlack_CheckedChanged(object sender)
{
UpdateImage();
}
}
}
......@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AOI;
using Asa.Theme;
namespace AccAOI.control
{
......@@ -23,12 +24,18 @@ namespace AccAOI.control
if (this.AoiInfo is AoiMethodRgb)
{
methodRgb = (AoiMethodRgb)AoiInfo;
txtMinR.Text = methodRgb.minR.ToString();
txtMaxR.Text = methodRgb.maxR.ToString();
txtMinG.Text = methodRgb.minG.ToString();
txtMaxG.Text = methodRgb.maxG.ToString();
txtMaxB.Text = methodRgb.maxB.ToString();
txtMinB.Text = methodRgb.minB.ToString();
//txtMinR.Text = methodRgb.minR.ToString();
//txtMaxR.Text = methodRgb.maxR.ToString();
//txtMinG.Text = methodRgb.minG.ToString();
// txtMaxG.Text = methodRgb.maxG.ToString();
// txtMaxB.Text = methodRgb.maxB.ToString();
// txtMinB.Text = methodRgb.minB.ToString();
SetTbValue(tbMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB);
txtminRate.Text = methodRgb.minRate.ToString();
txtmaxRate.Text = methodRgb.maxRate.ToString();
}
......@@ -46,6 +53,12 @@ namespace AccAOI.control
methodRgb.maxG = FormUtil.GetIntValue(txtMaxG);
methodRgb.maxB = FormUtil.GetIntValue(txtMaxB);
methodRgb.minB = FormUtil.GetIntValue(txtMinB);
SetTbValue(tbMinR, methodRgb.minR);
SetTbValue(tbMaxR, methodRgb.maxR);
SetTbValue(tbMinG, methodRgb.minG);
SetTbValue(tbMaxG, methodRgb.maxG);
SetTbValue(tbMaxB, methodRgb.maxB);
SetTbValue(tbMinB, methodRgb.minB);
methodRgb.minRate = FormUtil.GetIntValue(txtminRate);
methodRgb.maxRate = FormUtil.GetIntValue(txtmaxRate);
if (currPath != null)
......@@ -59,8 +72,12 @@ namespace AccAOI.control
private void UpdateImage()
public override void UpdateImage()
{
if (BaseImage == null)
{
return;
}
GetAoiInfo();
Image outImage = null;
float rate = methodRgb.GetRate(BaseImage, out outImage);
......@@ -78,5 +95,52 @@ namespace AccAOI.control
{
UpdateImage();
}
private void tbMinR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinR, tbMinR.Value);
}
private void tbMaxR_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxR, tbMaxR.Value);
}
private void tbMinG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinG, tbMinG.Value);
}
private void tbMaxG_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxG, tbMaxG.Value);
}
private void tbMinB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMinB, tbMinB.Value);
}
private void tbMaxB_ValueChanged(object sender, EventArgs e)
{
SetText(txtMaxB, tbMaxB.Value);
}
private void SetText(FlatText text, int value)
{
if (text.Text.ToString().Equals(value.ToString()))
{
return;
}
text.Text = value.ToString();
}
private void SetTbValue(TrackBar tb, int value)
{
if (tb.Value.Equals(value.ToString()))
{
return;
}
tb.Value = value;
}
}
}
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!