// fungsi untuk inisialisasi communication // jika 0 => single, 1 => 2 window // screen ukuran 64x16 public int InitComm(int modeWindow = 0) { int nRet = 0; string strPort; if (0 == m_nCommType) { strPort = "COM" + m_nPort; nRet = CP5200.CP5200_RS232_InitEx(Marshal.StringToHGlobalAnsi(strPort), m_nBaudrate, m_nTimeout); int rt = 0; if (modeWindow == 0) { // format reactangle (left,up,right,down) rt = CP5200.CP5200_RS232_SplitScreen(Convert.ToByte(1), 64, 32, 1, new int[] { 0, 0, 64, 16 }); } else { // format reactangle (left,up,right,down) rt = CP5200.CP5200_RS232_SplitScreen(Convert.ToByte(1), 64, 32, 2, new int[] { 0, 0, 32, 16, 32, 0, 64, 16 }); } } else { m_dwIPAddr = GetIP(IPAddr); if (0 != m_dwIPAddr) { m_dwIDCode = GetIP(IDCode); if (0 != m_dwIDCode) { CP5200.CP5200_Net_Init(m_dwIPAddr, m_nIPPort, m_dwIDCode, m_nTimeout); //CP5200.CP5200_Program_SetWindowProperty(0,0) int rt = 0; if (modeWindow == 0) { // format reactangle (left,up,right,down) rt = CP5200.CP5200_Net_SplitScreen(Convert.ToByte(1), 64, 32, 1, new int[] { 0, 0, 64, 16 }); } else { // format reactangle (left,up,right,down) rt = CP5200.CP5200_Net_SplitScreen(Convert.ToByte(1), 64, 32, 2, new int[] { 0, 0, 32, 16, 32, 0, 64, 16 }); } if (rt != 0) { MessageBox.Show("Failed split window"); } nRet = 1; } } } return(nRet); }
public int SplitWindow(int width = 0, int height = 0, int windCnt = 0) { int ret = 0; int[] nWndRect = new int[4]; nWndRect[0] = 0; nWndRect[1] = 0; nWndRect[2] = width; nWndRect[3] = height; if (0 == m_nCommType) { ret = CP5200.CP5200_RS232_SplitScreen(m_nCardID, width, height, windCnt, nWndRect); } else { ret = CP5200.CP5200_Net_SplitScreen(m_nCardID, width, height, windCnt, nWndRect); } return(ret); }