Exemple #1
0
        /// <summary>
        /// 发送多行文本(自动换行)
        /// </summary>
        /// <param name="content">发送文本内容</param>
        /// <param name="XValue">X坐标</param>
        /// <param name="YValue">Y坐标</param>
        /// <param name="Width">长度</param>
        /// <param name="Height">宽度</param>
        /// <param name="FontSize">字体大小</param>
        /// <param name="InStyle">显示方式</param>
        /// <param name="areano">区域号</param>
        /// <param name="nAlignment">水平对齐样式,0.左对齐  1.右对齐  2.水平居中</param>
        /// <returns></returns>
        public bool SendMultiLineTextToImageTextArea(string content, int XValue, int YValue, int Width, int Height, int FontSize, eInitStyle InStyle, int areano, int nAlignment)
        {
            int nResult;

            LedDll.AREARECT AreaRect = new LedDll.AREARECT();            //区域坐标属性结构体变量
            AreaRect.left   = XValue;
            AreaRect.top    = YValue;
            AreaRect.width  = Width;
            AreaRect.height = Height;

            LedDll.LV_AddImageTextArea(HProgram, 1, areano, ref AreaRect, 0);

            LedDll.FONTPROP FontProp = new LedDll.FONTPROP();            //文字属性
            FontProp.FontName  = "宋体";
            FontProp.FontSize  = FontSize;
            FontProp.FontColor = LedDll.COLOR_RED;
            FontProp.FontBold  = 0;

            LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP();
            PlayProp.InStyle   = Convert.ToInt32(InStyle);
            PlayProp.DelayTime = 3;
            PlayProp.Speed     = 4;
            //可以添加多个子项到图文区,如下添加可以选一个或多个添加

            nResult = LedDll.LV_AddMultiLineTextToImageTextArea(HProgram, 1, areano, LedDll.ADDTYPE_STRING, content, ref FontProp, ref PlayProp, nAlignment, 1);
            if (nResult != 0)            //如果失败则可以调用LV_GetError获取中文错误信息
            {
                ErrStr = LedDll.LS_GetError(nResult);
            }
            return(nResult == 0);
        }
Exemple #2
0
        /// <summary>
        /// 添加静止的文本
        /// </summary>
        /// <param name="content"></param>
        /// <param name="areano"></param>
        /// <returns></returns>
        public bool LV_AddStaticTextToImageTextArea(string content, int areano = 1)
        {
            int nResult;

            LedDll.AREARECT AreaRect = new LedDll.AREARECT();            //区域坐标属性结构体变量
            AreaRect.left   = 0;
            AreaRect.top    = 0;
            AreaRect.width  = this.LedWidth / 2;
            AreaRect.height = this.LedHeight;

            LedDll.FONTPROP FontProp = new LedDll.FONTPROP();            //文字属性
            FontProp.FontName  = "宋体";
            FontProp.FontSize  = 14;
            FontProp.FontColor = LedDll.COLOR_RED;
            FontProp.FontBold  = 0;

            nResult = LedDll.LV_AddStaticTextToImageTextArea(HProgram, 1, areano, 0, content, ref FontProp, 65535, 2, 1); //快速通过字符添加一个单行文本区域,函数见函数声明注示

            if (nResult != 0)                                                                                             //如果失败则可以调用LV_GetError获取中文错误信息
            {
                ErrStr = LedDll.LS_GetError(nResult);
            }

            return(nResult == 0);
        }
Exemple #3
0
        /// <summary>
        /// 添加边框
        /// </summary>
        /// <param name="XValue">X坐标</param>
        /// <param name="YValue">Y坐标</param>
        /// <param name="Width">长度</param>
        /// <param name="Height">宽度</param>
        /// <returns></returns>
        public bool AddWaterBorder(int XValue, int YValue, int Width, int Height, int areano)
        {
            int nResult;

            LedDll.AREARECT AreaRect = new LedDll.AREARECT();            //区域坐标属性结构体变量
            AreaRect.left   = XValue;
            AreaRect.top    = YValue;
            AreaRect.width  = Width;
            AreaRect.height = Height;

            LedDll.WATERBORDERINFO border = new LedDll.WATERBORDERINFO();            //流水边框属性结构体
            border.Flag        = 0;
            border.BorderType  = 0;
            border.BorderValue = 0;
            border.BorderStyle = 0;
            border.BorderSpeed = 0;
            border.BorderColor = 255;

            nResult = LedDll.LV_AddWaterBorder(HProgram, 1, areano, ref AreaRect, ref border);

            if (nResult != 0)            //如果失败则可以调用LV_GetError获取中文错误信息
            {
                ErrStr = LedDll.LS_GetError(nResult);
            }
            return(nResult == 0);
        }
Exemple #4
0
        /// <summary>
        /// 发送单行文本
        /// </summary>
        /// <param name="row1"></param>
        /// <returns></returns>
        public bool SendSingleTextAreaUnloadArea(string row1)
        {
            int nResult;

            LedDll.AREARECT AreaRect = new LedDll.AREARECT();            //区域坐标属性结构体变量
            AreaRect.left   = 0;
            AreaRect.top    = 0;
            AreaRect.width  = this.LedWidth / 2;
            AreaRect.height = this.LedHeight;

            LedDll.FONTPROP FontProp = new LedDll.FONTPROP();            //文字属性
            FontProp.FontName  = "宋体";
            FontProp.FontSize  = 14;
            FontProp.FontColor = LedDll.COLOR_RED;
            FontProp.FontBold  = 0;

            nResult = LedDll.LV_QuickAddSingleLineTextArea(HProgram, 1, AreaNo, ref AreaRect, LedDll.ADDTYPE_STRING, row1, ref FontProp, 4); //快速通过字符添加一个单行文本区域,函数见函数声明注示

            if (nResult != 0)                                                                                                                //如果失败则可以调用LV_GetError获取中文错误信息
            {
                ErrStr = LedDll.LS_GetError(nResult);
            }

            return(nResult == 0);
        }
Exemple #5
0
        public void test()
        {
            int nResult;

            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  = "宋体";
            FontProp.FontSize  = 12;
            FontProp.FontColor = LedDll.COLOR_RED;
            FontProp.FontBold  = 0;

            nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 1, 1, ref AreaRect, LedDll.ADDTYPE_STRING, "上海灵信视觉技术股份有限公司", ref FontProp, 4);            //快速通过字符添加一个单行文本区域,函数见函数声明注示

            AreaRect.left   = 64;
            AreaRect.top    = 16;
            AreaRect.width  = 64;
            AreaRect.height = 16;
            LedDll.DIGITALCLOCKAREAINFO DigitalClockAreaInfo = new LedDll.DIGITALCLOCKAREAINFO();
            DigitalClockAreaInfo.TimeColor = LedDll.COLOR_RED;

            DigitalClockAreaInfo.ShowStrFont.FontName = "宋体";
            DigitalClockAreaInfo.ShowStrFont.FontSize = 12;
            DigitalClockAreaInfo.IsShowHour           = 1;
            DigitalClockAreaInfo.IsShowMinute         = 1;


            nResult = LedDll.LV_AddDigitalClockArea(hProgram, 1, 2, ref AreaRect, ref DigitalClockAreaInfo); //注意区域号不能一样,详见函数声明注示

            nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram);                                       //发送,见函数声明注示
            LedDll.LV_DeleteProgram(hProgram);                                                               //删除节目内存对象,详见函数声明注示
            if (nResult != 0)                                                                                //如果失败则可以调用LV_GetError获取中文错误信息
            {
                string ErrStr;
                ErrStr = LedDll.LS_GetError(nResult);
            }
        }