示例#1
0
        //初始化打标系统
        private void btnInitSystem_Click(object sender, EventArgs e)
        {
            string strCurPath = System.Environment.CurrentDirectory;     //获取当前路径
            int    nRet       = CSharpInterface.HS_InitialMachine(strCurPath);

            if (nRet == 0)
            {
                tbNote.Text           = "打标系统初始化成功!";
                tsslabCardStatus.Text = "状态:初始化成功!";

                CSharpInterface.g_strPathName = strCurPath;
                m_bInitOk = true;

                double px = 0, py = 0;
                CSharpInterface.HS_GetMarkRange(ref px, ref py);
                tsslabMarkRange.Text = "打标范围:" + px.ToString() + "*" + py.ToString() + "mm";
                //设置预览滑标
                tbrX.SetRange(-(int)(px / 2), (int)(px / 2));
                tbrY.SetRange(-(int)(py / 2), (int)(py / 2));
                tbrS.SetRange(0, 100);
                ResetPreview();//设置滑标位置
            }
            else
            {
                ShowLastError();
                tsslabCardStatus.Text = "状态:初始化失败!";
            }
            UpdateView();
        }