/// <summary> /// 一个节目下设置一个图片区(表格的显示通过自绘图片并通过此方式添加发送) /// </summary> public void Button4_Click() { int hProgram; //节目句柄 hProgram = LedDll.LV_CreateProgram(64, 32, 3, 5, 0); //根据传的参数创建节目句柄,64是屏宽点数,32是屏高点数,2是屏的颜色,注意此处屏宽高及颜色参数必需与设置屏参的屏宽高及颜色一致,否则发送时会提示错误 //此处可自行判断有未创建成功,hProgram返回NULL失败,非NULL成功,一般不会失败 nResult = LedDll.LV_AddProgram(hProgram, 1, 0, 1); //添加一个节目,参数说明见函数声明注示 if (nResult != 0) { string ErrStr; ErrStr = LedDll.LS_GetError(nResult); Debug.Log(ErrStr); // MessageBox.Show(ErrStr); return; } LedDll.AREARECT AreaRect = new LedDll.AREARECT();//区域坐标属性结构体变量 AreaRect.left = 0; AreaRect.top = 0; AreaRect.width = 64; AreaRect.height = 32; LedDll.LV_AddImageTextArea(hProgram, 1, 1, ref AreaRect, 0); LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); PlayProp.InStyle = 0; PlayProp.DelayTime = 3; PlayProp.Speed = 4; //可以添加多个子项到图文区,如下添加可以选一个或多个添加 //可以添加多个子项到图文区,如下添加可以选一个或多个添加 nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.bmp", ref PlayProp); nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.jpg", ref PlayProp); nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.png", ref PlayProp); PlayProp.Speed = 3; nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.gif", ref PlayProp); nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram); //发送,见函数声明注示 LedDll.LV_DeleteProgram(hProgram); //删除节目内存对象,详见函数声明注示 if (nResult != 0) //如果失败则可以调用LV_GetError获取中文错误信息 { string ErrStr; ErrStr = LedDll.LS_GetError(nResult); Debug.Log(ErrStr); //MessageBox.Show(ErrStr); } else { Debug.Log("发送成功"); //MessageBox.Show("发送成功"); } }
public void Button4_Click() { int nResult; LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO();//定义一通讯参数结构体变量用于对设定的LED通讯,具体对此结构体元素赋值说明见COMMUNICATIONINFO结构体定义部份注示 CommunicationInfo.LEDType = 3; //TCP通讯******************************************************************************** CommunicationInfo.SendType = 0; //设为固定IP通讯模式,即TCP通讯 CommunicationInfo.IpStr = "192.168.1.245"; //给IpStr赋值LED控制卡的IP CommunicationInfo.LedNumber = 1; //LED屏号为1,注意socket通讯和232通讯不识别屏号,默认赋1就行了,485必需根据屏的实际屏号进行赋值 //广播通讯******************************************************************************** //CommunicationInfo.SendType=1;//设为单机直连,即广播通讯无需设LED控制器的IP地址 //串口通讯******************************************************************************** //CommunicationInfo.SendType=2;//串口通讯 //CommunicationInfo.Commport=1;//串口的编号,如设备管理器里显示为 COM3 则此处赋值 3 //CommunicationInfo.Baud=9600;//波特率 //CommunicationInfo.LedNumber=1; int hProgram; //节目句柄 hProgram = LedDll.LV_CreateProgram(64, 32, 3, 5, 0); //根据传的参数创建节目句柄,64是屏宽点数,32是屏高点数,2是屏的颜色,注意此处屏宽高及颜色参数必需与设置屏参的屏宽高及颜色一致,否则发送时会提示错误 //此处可自行判断有未创建成功,hProgram返回NULL失败,非NULL成功,一般不会失败 nResult = LedDll.LV_AddProgram(hProgram, 1, 0, 1); //添加一个节目,参数说明见函数声明注示 if (nResult != 0) { string ErrStr; ErrStr = LedDll.LS_GetError(nResult); Debug.Log(ErrStr); // MessageBox.Show(ErrStr); return; } LedDll.AREARECT AreaRect = new LedDll.AREARECT();//区域坐标属性结构体变量 AreaRect.left = 0; AreaRect.top = 0; AreaRect.width = 64; AreaRect.height = 32; LedDll.LV_AddImageTextArea(hProgram, 1, 1, ref AreaRect, 0); LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP(); PlayProp.InStyle = 0; PlayProp.DelayTime = 3; PlayProp.Speed = 4; //可以添加多个子项到图文区,如下添加可以选一个或多个添加 //可以添加多个子项到图文区,如下添加可以选一个或多个添加 nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.bmp", ref PlayProp); nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.jpg", ref PlayProp); nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.png", ref PlayProp); PlayProp.Speed = 3; nResult = LedDll.LV_AddFileToImageTextArea(hProgram, 1, 1, "test.gif", ref PlayProp); nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram); //发送,见函数声明注示 LedDll.LV_DeleteProgram(hProgram); //删除节目内存对象,详见函数声明注示 if (nResult != 0) //如果失败则可以调用LV_GetError获取中文错误信息 { string ErrStr; ErrStr = LedDll.LS_GetError(nResult); Debug.Log(ErrStr); //MessageBox.Show(ErrStr); } else { Debug.Log("发送成功"); //MessageBox.Show("发送成功"); } }