Exemplo n.º 1
0
        string FileName = "Test.Txt"; //文本文件名


        private void btnSend_Click(object sender, EventArgs e)
        {
            string S   = "";
            bool   bOK = false;
            bool   xb  = false;

            //Dim Buff(1024) As Byte
            //Dim Da As Long, Ti As Long
            Scl2008.TextInfoType TextInfo = new Scl2008.TextInfoType();

            if (bSCL2008)
            {
                TextInfo.Left = 4096 - LedWidth;
            }
            else
            {
                TextInfo.Left = 960 - LedWidth;
            }
            TextInfo.Top     = 0;
            TextInfo.Width   = LedWidth;
            TextInfo.Height  = LedHeight;
            TextInfo.Color   = CharColor;
            TextInfo.ASCFont = 1;
            TextInfo.HZFont  = 2;
            TextInfo.XPos    = 0;
            TextInfo.YPos    = 0;

            S = "";
            //Use 6x12,12x12 fonts
            S = S + "   `A1`H2`C0000FF红色12点显示";
            //Use 8x16,16x16 fonts
            S = S + "`A3`H4`C00FF00绿色16点显示AB";
            //Use 12x24,24x24 fonts
            S = S + "`A5`H6`C00FFFF黄色24点显示CD`Y000";
            //Use 16x32,32x32 fonts
            S = S + "`M3`A7`H8`C00FFFF反白32点显示EF";
            //通讯初始化
            if (bNet)
            {
                bOK = Scl2008.SCL_NetInitial(mDevID, "", IPAddr, TimeOut, RetryTimes, UDPPort, bSCL2008);
            }
            else
            {
                bOK = Scl2008.SCL_ComInitial(mDevID, ComPort, Baudrate, LedNum, TimeOut, RetryTimes, bSCL2008);
            }

            if (!bOK)
            {
                MessageBox.Show("初始化失败");
            }

            if (!bOnlyShowStatic)
            {
                //删除移动播出的文本文件
                //仅实现静止显示则可不调用这个函数
                if (bOK)
                {
                    bOK = Scl2008.SCL_RemoveFile(mDevID, 2, FileName);
                }
                if (!bOK)
                {
                    MessageBox.Show("删除文件失败");
                }

                //重启节目表,使屏幕静止(因为节目表中的文本文件不存在了)
                //仅实现静止显示则可不调用这个函数
                if (bOK)
                {
                    if (bSCL2008)
                    {
                        bOK = Scl2008.SCL_Replay(mDevID, 0, 0);
                    }
                    else
                    {
                        bOK = Scl2008.SCL_Replay(mDevID, 1, 0);
                    }
                    if (!bOK)
                    {
                        MessageBox.Show("重启节目表失败");
                    }
                    Thread.Sleep(500);
                }
            }

            //显示文字串,自动排版,超出部分自动截断
            if (bOK)
            {
                bOK = Scl2008.SCL_ShowString(mDevID, TextInfo.Left, S);
                if (!bOK)
                {
                    MessageBox.Show("文字直接输出失败");
                }
            }

            Scl2008.SCL_Close(mDevID);
        }
Exemplo n.º 2
0
        private void send(string s)
        {
            string S   = "";
            bool   bOK = false;
            bool   xb  = false;

            Scl2008.TextInfoType TextInfo = new Scl2008.TextInfoType();

            if (bSCL2008)
            {
                TextInfo.Left = 4096 - LedWidth;
            }
            else
            {
                TextInfo.Left = 960 - LedWidth;
            }
            TextInfo.Top     = 0;
            TextInfo.Width   = LedWidth;
            TextInfo.Height  = LedHeight;
            TextInfo.Color   = CharColor;
            TextInfo.ASCFont = 1;
            TextInfo.HZFont  = 2;
            TextInfo.XPos    = 0;
            TextInfo.YPos    = 0;

            //通讯初始化
            if (bNet)
            {
                bOK = Scl2008.SCL_NetInitial(mDevID, "", IPAddr, TimeOut, RetryTimes, UDPPort, bSCL2008);
            }
            else
            {
                bOK = Scl2008.SCL_ComInitial(mDevID, ComPort, Baudrate, LedNum, TimeOut, RetryTimes, bSCL2008);
            }

            if (!bOK)
            {
                MessageBox.Show("初始化失败");
            }

            if (!bOnlyShowStatic)
            {
                //删除移动播出的文本文件
                //仅实现静止显示则可不调用这个函数
                if (bOK)
                {
                    bOK = Scl2008.SCL_RemoveFile(mDevID, 2, FileName);
                }
                if (!bOK)
                {
                    MessageBox.Show("删除文件失败");
                }

                //重启节目表,使屏幕静止(因为节目表中的文本文件不存在了)
                //仅实现静止显示则可不调用这个函数
                if (bOK)
                {
                    if (bSCL2008)
                    {
                        bOK = Scl2008.SCL_Replay(mDevID, 0, 0);
                    }
                    else
                    {
                        bOK = Scl2008.SCL_Replay(mDevID, 1, 0);
                    }
                    if (!bOK)
                    {
                        MessageBox.Show("重启节目表失败");
                    }
                    Thread.Sleep(500);
                }
            }

            //显示文字串,自动排版,超出部分自动截断
            if (bOK)
            {
                bOK = Scl2008.SCL_ShowString(mDevID, TextInfo.Left, S);
                if (!bOK)
                {
                    MessageBox.Show("文字直接输出失败");
                }
            }

            Scl2008.SCL_Close(mDevID);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 发送到led方法
        /// </summary>
        /// <param name="s"></param>
        private void send(string S, short iX, short iY, short engFont, short hzFont)
        {
            try
            {
                bool bOK = false;
                Scl2008.TextInfoType TextInfo = new Scl2008.TextInfoType();

                if (bSCL2008)
                {
                    TextInfo.Left = Convert.ToInt16(4096 - LedWidth);
                }
                else
                {
                    TextInfo.Left = Convert.ToInt16(960 - LedWidth);
                }
                TextInfo.Top     = 0;
                TextInfo.Width   = LedWidth;
                TextInfo.Height  = LedHeight;
                TextInfo.Color   = CharColor;
                TextInfo.ASCFont = engFont; //英文字库默认3
                TextInfo.HZFont  = hzFont;  //汉字字库默认2
                //文本显示的起始位置 XPos 和YPose决定
                TextInfo.XPos = 0;
                TextInfo.YPos = 0;


                //通讯初始化
                if (!bNet)
                {
                    bOK = Scl2008.SCL_ComInitial(mDevID, ComPort, Baudrate, LedNum, TimeOut, RetryTimes, bSCL2008);
                }
                if (!bOK)
                {
                    //MessageBox.Show("发送 " +S + " 时初始化失败");
                    Log.WriteLog("发送  " + S + "  时初始化失败");
                }
                else
                {
                    Log.WriteLog("发送" + S + "初始化成功");
                }
                //显示文字串,自动排版,超出部分自动截断,最多1000个字符
                if (bOK)
                {
                    //文本显示的起始位置 XPos 和YPose决定
                    TextInfo.XPos = iX;
                    TextInfo.YPos = iY;
                    bOK           = Scl2008.SCL_ShowString(mDevID, ref TextInfo.Left, S);
                    if (!bOK)
                    {
                        //MessageBox.Show("发送-----" + S + "-----信息失败");
                        Log.WriteLog("发送-----" + S + "-----信息失败");
                    }
                    else
                    {
                        Log.WriteLog("发送-----" + S + "-----信息成功");
                    }
                }
                Scl2008.SCL_Close(mDevID);//再打有打不上
                Log.WriteLog("关闭led屏");
            }
            catch (Exception ee)
            {
                Log.WriteLog("发送led屏时出现异常:" + ee.Message);
            }
        }