Ejemplo n.º 1
0
        /// <summary>
        /// 发送文本数据到LED
        /// </summary>
        /// <param name="strText">要发送的字符串,用\n分行以显示多行</param>
        /// <param name="strFontName">字体名称,如宋体</param>
        /// <param name="nFontSize">字体大小,显示4行数据建议字体大小为10,显示5行数据建议字体大小为9,其余大小不太适合本案</param>
        /// <param name="nMethod">显示方式,建议为1。1.立即显示;2.左滚显示;3.连续上滚;4.中间向上下展开;5.中间向两边展开;6.中间向四周展开;7.向左移入;8.向右移入;9.从左向右展开;10.从右向左展开;11.右上角移入;12.右下角移入;13.左上角移入;14.左下角移入;15.从上向下移入;16.从下向上移入;17.闪  烁;</param>
        /// <param name="nSpeed">显示速度(1-8),越大越快,建议为1</param>
        /// <param name="nTransparent">是否透明。0=不透明 1=透明</param>
        public void SendText(string text, string fontName, int fontSize, int method, int speed, int transparent)
        {
            int ret = LedSdk.MakeRoot(LedSdk.ROOT_PLAY, LedSdk.SCREEN_COLOR);//创建一个发送序列,以前的将被清除

            if (ret == -1)
            {
                return;
            }
            ret = LedSdk.AddLeaf(86400000);                                  //增加一个页面
            if (ret == -1)
            {
                return;
            }
            LedSdk.Rectangle rect = new LedSdk.Rectangle();
            Font             font = new Font(fontName, fontSize);
            int height            = font.Height + 3;

            string[] strArray = text.Split(new char[] { '\n' });
            for (int i = 0; i < strArray.Length; i++)
            {
                ret = LedSdk.SetRect(ref rect, 0, height * i, 256, height * (i + 1));
                if (ret == -1)
                {
                    return;
                }
                ret = LedSdk.AddText(strArray[i], ref rect, method, speed, transparent, fontName, fontSize, 255);
                if (ret == -1)
                {
                    return;
                }
            }
            LedSdk.LED_SendToScreen(_dev, _address, _ip, _remote_port);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 发送文本数据到LED
 /// </summary>
 /// <param name="strText">要发送的字符串,用\n分行以显示多行</param>
 /// <param name="strFontName">字体名称,如宋体</param>
 /// <param name="nFontSize">字体大小,显示4行数据建议字体大小为10,显示5行数据建议字体大小为9,其余大小不太适合本案</param>
 /// <param name="nMethod">显示方式,建议为1。1.立即显示;2.左滚显示;3.连续上滚;4.中间向上下展开;5.中间向两边展开;6.中间向四周展开;7.向左移入;8.向右移入;9.从左向右展开;10.从右向左展开;11.右上角移入;12.右下角移入;13.左上角移入;14.左下角移入;15.从上向下移入;16.从下向上移入;17.闪  烁;</param>
 /// <param name="nSpeed">显示速度(1-8),越大越快,建议为1</param>
 /// <param name="nTransparent">是否透明。0=不透明 1=透明</param>
 public void SendText(string text, string fontName, int fontSize, int method, int speed, int transparent)
 {
     int ret = LedSdk.MakeRoot(LedSdk.ROOT_PLAY, LedSdk.SCREEN_COLOR);//创建一个发送序列,以前的将被清除
     if (ret == -1) return;
     ret = LedSdk.AddLeaf(86400000);                                  //增加一个页面
     if (ret == -1) return;
     LedSdk.Rectangle rect = new LedSdk.Rectangle();
     Font font = new Font(fontName, fontSize);
     int height = font.Height + 3;
     string[] strArray = text.Split(new char[] { '\n' });
     for (int i = 0; i < strArray.Length; i++)
     {
         ret = LedSdk.SetRect(ref rect, 0, height * i, 256, height * (i + 1));
         if (ret == -1) return;
         ret = LedSdk.AddText(strArray[i],ref rect, method, speed, transparent, fontName, fontSize, 255);
         if (ret == -1) return;
     }
     LedSdk.LED_SendToScreen(_dev, _address, _ip, _remote_port);
 }