예제 #1
0
        private void btnWriteOutPort_Click(object sender, EventArgs e)
        {
            try
            {
                m_dwOutPort = Convert.ToInt32(this.tbOutPort.Text);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("请输入一个正整数输入!\n" + ex.Message, "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                m_dwOutPort         = 0;
                this.tbOutPort.Text = "0";
                return;
            }
            if (m_dwOutPort < 0)
            {
                MessageBox.Show("请输入一个正整数输入!", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                m_dwOutPort         = 0;
                this.tbOutPort.Text = "0";
                return;
            }

            int nRet = CSharpInterface.HS_WritePort(m_dwOutPort, 0xFFFF);

            if (0 == nRet)
            {
                tbNote.Text = "Write output port successfully!";
            }
            else
            {
                tbNote.Text = "Write output port failed!";
                MessageBox.Show("操作失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        //设置
        private void btnSet_Click(object sender, EventArgs e)
        {
            int nRet = CSharpInterface.HS_SetFontPara2(m_nFontType, nCharSet, m_strFontName, m_strShxCN, m_strShxEN, m_strShxNum);

            if (nRet == 0)
            {
                MessageBox.Show("设置字体参数成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("设置字体参数失败!\n" + CSharpInterface.GetError(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        //改变层时,显示相应层的参数
        private void numudLayerNo_ValueChanged(object sender, EventArgs e)
        {
            m_nLayerNo = Convert.ToInt32(numudLayerNo.Value);
            int nRet = CSharpInterface.HS_GetLayerPara(m_nLayerNo, ref m_layerPara);

            if (nRet != 0)
            {
                MessageBox.Show("读取层参数数据失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            SetData(false);
        }
예제 #4
0
        //输入口读入
        private void btnReadInPort_Click(object sender, EventArgs e)
        {
            int nRet = CSharpInterface.HS_ReadPort(ref m_dwInPort);

            if (0 == nRet)
            {
                tbNote.Text        = "Read input port successfully!";
                this.tbInPort.Text = m_dwInPort.ToString();
            }
            else
            {
                tbNote.Text = "Read input port failed!";
                MessageBox.Show("操作失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        //窗口加载函数
        private void SetLayerParaForm_Load(object sender, EventArgs e)
        {
            numudLayerNo.Maximum = m_nLayerCount - 1;
            numudLayerNo.Minimum = 0;

            m_nLayerNo = 0;
            int nRet = CSharpInterface.HS_GetLayerPara(m_nLayerNo, ref m_layerPara);

            if (nRet != 0)
            {
                MessageBox.Show("读取层参数数据失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            SetData(false);
        }
예제 #6
0
        //设置层参数
        private void btnSet_Click(object sender, EventArgs e)
        {
            // TODO: Add your control notification handler code here
            if (SetData(true) == false)
            {
                return;
            }
            int nRet = CSharpInterface.HS_SetLayerPara(m_nLayerNo, ref m_layerPara);

            if (nRet == 0)
            {
                MessageBox.Show("层参数设置成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("层参数设置失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #7
0
파일: MotorSetForm.cs 프로젝트: yyiou/test
        private void btnHome_Click(object sender, EventArgs e)
        {
            if (UpdateData(true) == false)
            {
                return;
            }
            this.tbNote.Text = "";
            int nRet = CSharpInterface.HS_HomeMoveV(m_nAxisNo, m_bSoft0);

            if (0 == nRet)
            {
                this.tbNote.Text = "Move motor successfully!";
            }
            else
            {
                MessageBox.Show("操作失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #8
0
        private void SetHatchParaForm_Load(object sender, EventArgs e)
        {
            int nRet = CSharpInterface.HS_GetHatchPara(ref m_hatchPara);

            if (nRet != 0)
            {
                MessageBox.Show("读取填充参数失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();//关闭此窗口
            }

            m_bFillFirst = m_hatchPara.bFillFirst;
            m_fillData1  = m_hatchPara.newFileData1;
            m_fillData2  = m_hatchPara.newFileData2;

            SetFillData(0, false);
            m_nPrevFillNo = m_nFillNo = 0;
            UpdateDataView();
            UpdateData(false);
        }
예제 #9
0
파일: MotorSetForm.cs 프로젝트: yyiou/test
        private void btnTest_Click(object sender, EventArgs e)
        {
            if (UpdateData(true) == false)
            {
                return;
            }
            this.tbNote.Text = "";

            //MessageBox.Show(m_nAxisNo.ToString() + "," + m_dbMoveValue.ToString() + "," + m_nModel.ToString() + "," + m_nType.ToString());
            int nRet = CSharpInterface.HS_MoveMotorV(m_nAxisNo, m_dbMoveValue, m_nModel, m_nType);

            if (0 == nRet)
            {
                this.tbNote.Text = "Move motor successfully!";
            }
            else
            {
                MessageBox.Show("操作失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #10
0
        private void btnQueryTouch_Click(object sender, EventArgs e)
        {
            int nTouchFlag = 0;
            int nRet       = CSharpInterface.HS_IsTouch(ref nTouchFlag);

            if (nRet != 0)
            {
                tbNote.Text = "脚踏查询失败!";
                MessageBox.Show("操作失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (nTouchFlag != 0)
                {
                    tbNote.Text = "Touch trigger!";
                }
                else
                {
                    tbNote.Text = "Touch is not triggered!";
                }
            }
        }
예제 #11
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            if (UpdateData(true) == false)
            {
                return;
            }
            SetFillData(m_nFillNo, true);
            m_hatchPara.bFillFirst   = m_bFillFirst;
            m_hatchPara.newFileData1 = m_fillData1;
            m_hatchPara.newFileData2 = m_fillData2;

            int nRet = CSharpInterface.HS_SetHatchPara(ref m_hatchPara);

            if (nRet == 0)
            {
                MessageBox.Show("设置成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("设置失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #12
0
        //窗口加载
        private void SetFontParaForm_Load(object sender, EventArgs e)
        {
            int nRet = CSharpInterface.HS_GetFontPara(ref m_fontPara);

            if (nRet != 0)
            {
                MessageBox.Show("读取字体数数据失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            m_nType       = m_nFontType = m_fontPara.naFontType;
            m_strFontName = new String(m_fontPara.szFontName);
            m_strShxCN    = new String(m_fontPara.szShxCN);
            m_strShxEN    = new String(m_fontPara.szShxEN);
            m_strShxNum   = new String(m_fontPara.szShxNum);

            if (m_nFontType == 0)
            {
                m_lf.lfFaceName = System.Text.Encoding.Default.GetBytes(m_fontPara.szFontName.ToString());
            }
            else if (m_nFontType == 1)
            {
                m_strFontCHS = new String(m_fontPara.szShxCN);
                m_strFontEN  = new String(m_fontPara.szShxEN);
                m_strFontNUM = new String(m_fontPara.szShxNum);
            }
            else if (m_nFontType == 2)
            {
                m_strFontUser = new String(m_fontPara.szFontName);
            }
            else if (m_nFontType == 3)
            {
                m_strHzkType = new String(m_fontPara.szShxCN);
                m_strAscType = new String(m_fontPara.szShxEN);
            }

            UpdateData(false);

            //初始化字体信息
            DirectoryInfo dircinfo1 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\PFonts\\");

            foreach (FileInfo fileinfo1 in dircinfo1.GetFiles())
            {
                this.cmbCHS.Items.Add(fileinfo1.Name.Remove(fileinfo1.Name.LastIndexOf(".")));
            }
            cmbCHS.SelectedText = m_strFontCHS;

            DirectoryInfo dircinfo2 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\EFonts\\");

            foreach (FileInfo fileinfo2 in dircinfo2.GetFiles())
            {
                this.cmbEN.Items.Add(fileinfo2.Name.Remove(fileinfo2.Name.LastIndexOf(".")));
                this.cmbNUM.Items.Add(fileinfo2.Name.Remove(fileinfo2.Name.LastIndexOf(".")));
            }
            cmbEN.SelectedText  = m_strFontEN;
            cmbNUM.SelectedText = m_strFontNUM;

            DirectoryInfo dircinfo3 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\Font\\");

            foreach (FileInfo fileinfo3 in dircinfo3.GetFiles())
            {
                this.cmbUser.Items.Add(fileinfo3.Name.Remove(fileinfo3.Name.LastIndexOf(".")));
            }
            cmbUser.SelectedText = m_strFontUser;

            cmbMatrixEnNum.Items.Add("5*7");
            cmbMatrixEnNum.Items.Add("8*16");
            cmbMatrixCHS.Items.Add("12*12");
            cmbMatrixCHS.Items.Add("14*14");
            cmbMatrixCHS.Items.Add("16*16");

            UpdateDataView();
        }