FrmLearning.cs 4.9 KB
using Acc.ImageBox;
using OnlineStore.DeviceLibrary;
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 OnlineStore.AutoCountClient
{
    public partial class FrmLearning : Form
    {
        public FrmLearning()
        {
            InitializeComponent();
        }
        private ImageBox currShowBox = null;
        private int CurrType = -1;
        private bool IsCanSel = false;

        private string CurrFullFileName = "";
        private string CurrPN = "";

        private void FrmLearning_Load(object sender, EventArgs e)
        {
            imageBox0.Image = XRayLearnManager.modelImg_0;
            imageBox1.Image = XRayLearnManager.modelImg_1;
            imageBox2.Image = XRayLearnManager.modelImg_2;
            imageBox3.Image = XRayLearnManager.modelImg_3;
            imageBox4.Image = XRayLearnManager.modelImg_4;
            imageBox5.Image = XRayLearnManager.modelImg_5;

            pictureBox1.Image = XRayLearnManager.smodelImg_1;
            pictureBox2.Image = XRayLearnManager.smodelImg_2;
            pictureBox3.Image = XRayLearnManager.smodelImg_3;
            pictureBox4.Image = XRayLearnManager.smodelImg_4;
            pictureBox5.Image = XRayLearnManager.smodelImg_5;

            imageBox0.Text = "未找到元器件类型";
            imageBox1.Text = "小器件";
            imageBox2.Text = "大器件";
            imageBox3.Text = "异形三角器件";
            imageBox4.Text = "异形三脚大器件";
            imageBox5.Text = "异形长条形器件";
            ChangeImage(imageBox0);
        }

        public void UpdateCurrImg(string fullFName)
        {

            string testFile = Application.StartupPath + "\\XRAY\\model\\8D.03906.H11-R515232020062200253-20200812181219.png";
        }


        private void ChangeSelStatus(bool iscanSel)
        {
            this.IsCanSel = iscanSel; 
            ChangeImage(imageBox0, 0, ""); 
            groupBox3.Visible = iscanSel; 
        }


        private bool ChangeImage(ImageBox showImg, int type = 0, string text = "")
        {
            if (CurrType.Equals(type))
            {
                return true;
            }
            CurrType = type;
            if (currShowBox == null)
            {
                imageBox0.Visible = false;
                imageBox1.Visible = false;
                imageBox2.Visible = false;
                imageBox3.Visible = false;
                imageBox4.Visible = false;
                imageBox5.Visible = false;
            }
            else
            {
                currShowBox.Visible = false;
            }

            showImg.Visible = true;
            currShowBox = showImg;

            if (text.Equals(""))
            {
                btnTest.Visible = false;
            }
            else
            {
                btnTest.Text = "使用[" + text + "]模板点料测试";
                btnTest.Visible = true;
            }
            return true;
        }

      

        private void btnTest_Click(object sender, EventArgs e)
        {
            int count = 1;
            if (imgCurrImg.Image == null || String.IsNullOrEmpty(CurrFullFileName)) 
            {
                MessageBox.Show("未加载图片,无法点料");
                return;
            }


        }

        private void radioButton0_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox0, 0);
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox1, 1, radioButton1.Text);
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox2, 2, radioButton2.Text);
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox3, 3, radioButton3.Text);
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox4, 4, radioButton4.Text);
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            ChangeImage(imageBox5, 5, radioButton5.Text);
        }


        private void pictureBox1_Click(object sender, EventArgs e)
        {
            radioButton1.Checked = true;
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            radioButton2.Checked = true;
        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {
            radioButton3.Checked = true;
        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {
            radioButton4.Checked = true;
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            radioButton5.Checked = true;
        }
    }
}