Exemplo n.º 1
0
        private void btnSendStaticText_Click(object sender, EventArgs e)
        {
            int ret = 0;

            m_nWidth  = Convert.ToInt32(m_edtWidth.Text);
            m_nHeight = Convert.ToInt32(m_edtHeight.Text);
            if (1 == InitComm())
            {
                if (0 == m_nCommType)
                {
                    ret = CP5200.CP5200_RS232_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(m_edtStaticText.Text), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, m_nWidth, m_nHeight);
                }
                else
                {
                    ret = CP5200.CP5200_Net_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(m_edtStaticText.Text), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, m_nWidth, m_nHeight);
                }

                if (0 <= ret)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Fail");
                }
            }
        }
Exemplo n.º 2
0
        private void btnSendStaticText_Click(object sender, System.EventArgs e)
        {
            int nRet;

            int[] nWndRect = new int[8];
            GetSplitWnd(nWndRect);
            InitComm();

            if (m_nCommType == 1)              //網口
            {
                nRet = CP5200.CP5200_Net_SendStatic(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtStaticText.Text), 0xFF, 16, 0,
                                                    0, 0, nWndRect[2 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[0 + m_cmbWndNo.SelectedIndex * 4], nWndRect[3 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[1 + m_cmbWndNo.SelectedIndex * 4]);
            }
            else             //串口
            {
                nRet = CP5200.CP5200_RS232_SendStatic(Convert.ToByte(m_cmbCardID.SelectedIndex + 1), m_cmbWndNo.SelectedIndex, Marshal.StringToHGlobalAnsi(m_txtStaticText.Text), 0xFF, 16, 0,
                                                      0, 0, nWndRect[2 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[0 + m_cmbWndNo.SelectedIndex * 4], nWndRect[3 + m_cmbWndNo.SelectedIndex * 4] - nWndRect[1 + m_cmbWndNo.SelectedIndex * 4]);
            }

            if (nRet >= 0)
            {
                MessageBox.Show("Successful");
            }
            else
            {
                MessageBox.Show("Fail");
            }
        }