Exemple #1
0
        private void ledkanban(string TempIP, string Tempst, string message, string Jd, string strcolor)
        {
            int nResult;

            LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO();
            CommunicationInfo.SendType  = 0;
            CommunicationInfo.IpStr     = TempIP;
            CommunicationInfo.LedNumber = 1;
            int hProgram;

            hProgram = LedDll.LV_CreateProgram(64, 32, 2);
            nResult  = LedDll.LV_AddProgram(hProgram, 1, 0, 10);
            if (nResult != 0)
            {
                string ErrStr;
                ErrStr = LedDll.LS_GetError(nResult);
                MessageBox.Show(ErrStr);
                return;
            }
            LedDll.AREARECT AreaRect = new LedDll.AREARECT();
            AreaRect.left   = 0;
            AreaRect.top    = 0;
            AreaRect.width  = 64;
            AreaRect.height = 16;
            LedDll.FONTPROP FontProp = new LedDll.FONTPROP();
            FontProp.FontName = "Arial";
            FontProp.FontSize = 10;
            if (strcolor == "r")
            {
                FontProp.FontColor = LedDll.COLOR_RED;
            }
            else if (strcolor == "g")
            {
                FontProp.FontColor = LedDll.COLOR_GREEN;
            }

            FontProp.FontBold = 0;
            nResult           = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 1, 1, ref AreaRect, LedDll.ADDTYPE_STRING, message, ref FontProp, 4);
            AreaRect.left     = 0;
            AreaRect.top      = 16;
            AreaRect.width    = 64;
            AreaRect.height   = 16;
            FontProp.FontSize = 10;
            LedDll.LV_AddSingleLineTextToImageTextArea(hProgram, 1, 2, ref AreaRect, 0);
            nResult            = LedDll.LV_AddStaticTextToImageTextArea(hProgram, 1, 2, LedDll.ADDTYPE_STRING, Tempst, ref FontProp, 1, 2, 1);
            nResult            = LedDll.LV_AddProgram(hProgram, 2, 0, 5);
            AreaRect.left      = 0;
            AreaRect.top       = 16;
            AreaRect.width     = 64;
            AreaRect.height    = 16;
            FontProp.FontName  = "Arial";
            FontProp.FontSize  = 10;
            FontProp.FontColor = LedDll.COLOR_GREEN;
            FontProp.FontBold  = 0;
            LedDll.LV_AddSingleLineTextToImageTextArea(hProgram, 2, 2, ref AreaRect, 0);
            nResult = LedDll.LV_AddStaticTextToImageTextArea(hProgram, 2, 2, LedDll.ADDTYPE_STRING, Jd, ref FontProp, 1, 2, 1);


            // nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 2, 2, ref AreaRect, LedDll.ADDTYPE_STRING, Jd , ref FontProp, 4);
            AreaRect.left     = 0;
            AreaRect.top      = 0;
            AreaRect.width    = 64;
            AreaRect.height   = 16;
            FontProp.FontSize = 10;
            LedDll.LV_AddSingleLineTextToImageTextArea(hProgram, 2, 1, ref AreaRect, 0);
            nResult = LedDll.LV_AddStaticTextToImageTextArea(hProgram, 2, 1, LedDll.ADDTYPE_STRING, "Completed", ref FontProp, 1, 2, 1);
            nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram);
            LedDll.LV_DeleteProgram(hProgram);
            if (nResult != 0)
            {
                string ErrStr;
                ErrStr = LedDll.LS_GetError(nResult);

                listBox1.Items.Add(ErrStr);
            }
            else
            {
                listBox1.Items.Add(TempIP + "    LED发发送成功");
            }
        }