一個簡單的LED程序


生產,操作,常需要,用LED屏顯示一些信息

下面給一個最簡單的LED實例程序:本實例使用LEDSender2010.dll類庫

適用於中天等LED!

1.建立窗體:

/*
 * Created by SharpDevelop.
 * User: gaofajin
 * Date: 2015/10/20
 * Time: 19:50
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
namespace LedTest
{
 /// <summary>
 /// Description of MainForm.
 /// </summary>
 public partial class MainForm : Form
 {
  CLEDSender LedSenderHelper;
     public MainForm ()
        {
            InitializeComponent();
           lab_rtnMsg.Text = "已准備好";
            LedSenderHelper = new CLEDSender();
        }
  public MainForm(string text)
  {
   
   InitializeComponent();
            this.Text = text;
   lab_rtnMsg.Text="已准備好";
    LedSenderHelper=new CLEDSender ();
  }
 
   TDeviceParam GetDeviceParam()
  {
    TDeviceParam dp=new TDeviceParam ();
   dp.devType=LedSenderHelper.DEVICE_TYPE_UDP;
   dp.locPort=(ushort )Convert.ToInt16(txt_lPort.Text.Trim());
   dp.rmtHost =txt_IP.Text;
   dp.rmtPort  =(ushort )Convert.ToInt16( txt_rport .Text.Trim());
   dp.dstAddr =(ushort)Convert.ToInt16(txt_addr.Text);
   return dp;
  }
  
  void OpenPower()
  {
   TSenderParam sp=new TSenderParam ();
   sp.devParam=GetDeviceParam();
   sp.notifyMode =LedSenderHelper.NOTIFY_BLOCK;
   sp.wmHandle=(UInt32)Handle;
   sp.wmMessage=Convert.ToUInt32(1025);
   lab_rtnMsg.Text="正在打開電源";
      InsertCmd(LedSenderHelper.Do_LED_SetPower(ref sp, 1));
     
  }
  void ClosePower()
  {
   TSenderParam sp=new TSenderParam ();
    sp.devParam=GetDeviceParam();
   sp.notifyMode =LedSenderHelper.NOTIFY_BLOCK;
   sp.wmHandle=(UInt32)Handle;
   sp.wmMessage=Convert.ToUInt32(1025);
   lab_rtnMsg.Text="正在關閉電源";
   InsertCmd(LedSenderHelper.Do_LED_SetPower(ref sp, 0)); 
   }
  void ButtonClick(object sender,EventArgs e)
  {
   Button btn=sender as Button;
   switch (btn.Name )
   {
    case"btn_OpenPower":
     OpenPower();
      
     break;
    case"btn_ClosePower":
     ClosePower();
     break;
    case"btn_SendMsg":
     SendMsg(Rtxt_Msg.Text);
     break;
     default :
      break;
   }
  }
  
   void SendMsg(string Msg)
    {
     TSenderParam sp=new TSenderParam ();
     ushort K;
      sp.devParam=GetDeviceParam();
     sp.notifyMode =LedSenderHelper.NOTIFY_BLOCK;
   sp.wmHandle=(UInt32)Handle;
   sp.wmMessage=1025;
   //參數一制定方式是下載還是發送,play為發送
   //參數二顏色模式,單色雙色,
   //參數三節目顯示時間,超過此時間顯示下載下去的節目,此參數只在發送方式下有用
    K = (ushort)LedSenderHelper.Do_MakeRoot(LedSenderHelper.ROOT_PLAY, LedSenderHelper.COLOR_MODE_DOUBLE, LedSenderHelper.SURVIVE_ALWAYS);
            LedSenderHelper.Do_AddChapter(K, 30000, LedSenderHelper.WAIT_CHILD);
            LedSenderHelper.Do_AddRegion(K, 0, 0, 192, 32, 0);
            LedSenderHelper.Do_AddLeaf(K, 10000, LedSenderHelper.WAIT_CHILD);
            //參數
            //1.節目數據一般都是固定的K(上面,區域,頁面等的返回值)
            //2.左邊
            //3.頂邊
            //4.長度
            //5.寬度
            //6.是都透明
            //7.邊框
            //8.要發送的文字
            //9.字體名
            //10.字體大小
            //11.字體顏色
            //12.字體樣式
            //13.是否還行
            //14引入方式(下面有列表說明)
            // 15 引入速度(取值范圍0-5,從快到慢)
            // 16 引出方式(下面有列表說明)
            // 17引出速度(取值范圍0-5,從快到慢)
            // 18 停留方式(下面有列表說明)
            // 19停留速度(取值范圍0-5,從快到慢)
            // 20 停留時間(單位毫秒)

            int huangheng = LedSenderHelper.V_FALSE;
            if (checkBox1.Checked==true)
            {
                huangheng = LedSenderHelper.V_TRUE;
            }
            ParaSet ps=new ParaSet ();
            GetParaSet(ref ps);
            LedSenderHelper.Do_AddText(K, Int32.Parse(txt_Left.Text), Int32.Parse(txt_Right.Text), Int32.Parse(txt_Width.Text), Int32.Parse(txt_Height.Text), LedSenderHelper.V_TRUE, 0, Msg, "宋體",Int32.Parse(txt_Fontsize.Text), 0xffff, LedSenderHelper.WFS_NONE, huangheng, 0, ps.inStyle, ps.inSpeed,ps.outStyle ,ps.outSpeed ,ps.tlStyle ,ps.tlSpeed,ps.tlTime);
            lab_rtnMsg.Text = "正在執行命令或者發送數據...";           
            InsertCmd(LedSenderHelper.Do_LED_SendToScreen(ref sp, K));
    }
      private void InsertCmd(Int32 K)
        {
            TNotifyParam notifyparam = new TNotifyParam();
            if (K >= 0)
            {
                LedSenderHelper.Do_LED_GetNotifyParam(ref notifyparam, K);

                if (notifyparam.notify ==LedSenderHelper.LM_TIMEOUT)
                {
                   lab_rtnMsg.Text = "命令執行超時";
                }
                else if (notifyparam.notify == LedSenderHelper.LM_TX_COMPLETE)
                {
                    if (notifyparam.result == LedSenderHelper.RESULT_FLASH)
                    {
                        lab_rtnMsg.Text = "數據傳送完成,正在寫入Flash";
                    }
                    else
                    {
                       lab_rtnMsg.Text = "數據傳送完成";
                    }
                }
                else if (notifyparam.notify == LedSenderHelper.LM_RESPOND)
                {
                    if (notifyparam.command == LedSenderHelper.PKC_GET_POWER)
                    {
                        if (notifyparam.status == LedSenderHelper.LED_POWER_ON)
                            lab_rtnMsg.Text = "讀取電源狀態完成,當前為電源開啟狀態";
                        else if (notifyparam.status == LedSenderHelper.LED_POWER_OFF)
                            lab_rtnMsg.Text = "讀取電源狀態完成,當前為電源關閉狀態";
                    }
                    else if (notifyparam.command == LedSenderHelper.PKC_SET_POWER)
                    {
                        if (notifyparam.result == 99)
                            lab_rtnMsg.Text = "當前為定時開關屏模式";
                        else if (notifyparam.status == LedSenderHelper.LED_POWER_ON)
                            lab_rtnMsg.Text = "設置電源狀態完成,當前為電源開啟狀態";
                        else lab_rtnMsg.Text = "設置電源狀態完成,當前為電源關閉狀態";
                    }
                    else if (notifyparam.command == LedSenderHelper.PKC_GET_BRIGHT)
                    {
                        lab_rtnMsg.Text = string.Format("讀取亮度完成,當前亮度={0:D}", notifyparam.status);
                    }
                    else if (notifyparam.command == LedSenderHelper.PKC_SET_BRIGHT)
                    {
                        if (notifyparam.result == 99) lab_rtnMsg.Text = "當前為定時亮度調節模式";
                        else lab_rtnMsg.Text = string.Format("設置亮度完成,當前亮度={0:D}", notifyparam.status);
                    }
                    else if (notifyparam.command == LedSenderHelper.PKC_ADJUST_TIME)
                    {
                       lab_rtnMsg.Text = "校正顯示屏時間完成";
                    }
                }
            }
            else if (K == LedSenderHelper.R_DEVICE_INVALID)
                lab_rtnMsg.Text = "打開通訊設備失敗(串口不存在、或者串口已被占用、或者網絡端口被占用)";
            else if (K == LedSenderHelper.R_DEVICE_BUSY)
                lab_rtnMsg.Text = "設備忙,正在通訊中...";
        }
     
      void GetParaSet(ref ParaSet ps )
      {
       
       ps.inStyle=Convert.ToInt32( txt_InStyle.Text);
       ps.inSpeed=Convert.ToInt32(txt_inSpeed.Text);
       ps.outStyle=Convert.ToInt32(txt_OutStyle.Text);
       ps.outSpeed=Convert.ToInt32(txt_OutSpeed.Text);
       ps.tlStyle=Convert.ToInt32(txt_TlStyle.Text);
       ps.tlSpeed =Convert.ToInt32(txt_TlSpeed.Text);
       ps.tlTime=Convert.ToInt32(txt_TlTime.Text);
      }

 }
}

2.LED幫助類:

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices; // 用 DllImport 需用此 命名空間

namespace LedTest
{
    //設備通訊參數
    public struct TDeviceParam
    {
        public ushort devType;
        public ushort comSpeed;
        public ushort comPort;
        public ushort comFlow;
        public ushort locPort;
        public ushort rmtPort;
        public ushort srcAddr;
        public ushort dstAddr;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
        public String rmtHost;
        public uint txTimeo;   //發送后等待應答時間 ====超時時間應為txTimeo*txRepeat
        public uint txRepeat;  //失敗重發次數
        public uint txMovewin; //划動窗口
        public uint key;       //通訊密鑰
        public int pkpLength;  //數據包大小

    }

    //設備控制參數
    public struct TSenderParam
    {
        public TDeviceParam devParam;
        public UInt32 wmHandle;
        public UInt32 wmMessage;
        public UInt32 wmLParam;
        public UInt32 notifyMode;
    }

    //設備應答消息參數
    public struct TNotifyParam
    {
        public ushort notify;
        public ushort command;
        public Int32 result;
        public Int32 status;
        TSenderParam param;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
        public byte[] buffer;
        UInt32 size;
    }

    //SYSTEMTIME型日期時間結構
    public struct TSystemTime
    {
        public ushort wYear;
        public ushort wMonth;
        public ushort wDayOfWeek;
        public ushort wDay;
        public ushort wHour;
        public ushort wMinute;
        public ushort wSecond;
        public ushort wMilliseconds;
    }

    //TimeStamp型日期時間結構
    public struct TTimeStamp
    {
        public Int32 time;
        public Int32 date;
    }

    class CLEDSender
    {
        //通訊設備類型
        public readonly ushort DEVICE_TYPE_COM = 0;  //串口通訊
        public readonly ushort DEVICE_TYPE_UDP = 1;  //網絡通訊
        public readonly ushort DEVICE_TYPE_485 = 2;  //485通訊

        //串口或者485通訊使用得通訊速度(波特率)
        public readonly ushort SBR_57600 = 0;
        public readonly ushort SBR_38400 = 1;
        public readonly ushort SBR_19200 = 2;
        public readonly ushort SBR_9600  = 3;

        //是否等待下位機應答,直接發送所有數據
        public readonly UInt32 NOTIFY_NONE  = 1;
        //是否阻塞方式;是則等到發送完成或者超時,才返回;否則立即返回
        public readonly UInt32 NOTIFY_BLOCK = 2;
        //是否將發送結果以Windows窗體消息方式送到調用得應用
        public readonly UInt32 NOTIFY_EVENT = 4;

        public readonly Int32 R_DEVICE_READY    = 0;
        public readonly Int32 R_DEVICE_INVALID  = -1;
        public readonly Int32 R_DEVICE_BUSY     = -2;
        public readonly Int32 R_FONTSET_INVALID = -3;
        public readonly Int32 R_DLL_INIT_IVALID = -4;
        public readonly Int32 R_IGNORE_RESPOND  = -5;

        //下位機應答標識
        public readonly ushort LM_RX_COMPLETE = 1;
        public readonly ushort LM_TX_COMPLETE = 2;
        public readonly ushort LM_RESPOND     = 3;
        public readonly ushort LM_TIMEOUT     = 4;
        public readonly ushort LM_NOTIFY      = 5;
        public readonly ushort LM_PARAM       = 6;
        public readonly ushort LM_TX_PROGRESS = 7;
        public readonly ushort LM_RX_PROGRESS = 8;
        public readonly ushort RESULT_FLASH = 0xff;

        //命令代碼定義
        public readonly ushort PKC_RESPOND     = 3;
        public readonly ushort PKC_QUERY       = 4;
        public readonly ushort PKC_OVERFLOW    = 5;
        public readonly ushort PKC_ADJUST_TIME = 6;
        public readonly ushort PKC_GET_PARAM   = 7;
        public readonly ushort PKC_SET_PARAM   = 8;
        public readonly ushort PKC_GET_POWER   = 9;
        public readonly ushort PKC_SET_POWER   = 10;
        public readonly ushort PKC_GET_BRIGHT  = 11;
        public readonly ushort PKC_SET_BRIGHT  = 12;

        //電源開關參數值
        public readonly Int32 LED_POWER_ON  = 1;
        public readonly Int32 LED_POWER_OFF = 0;

        //Chapter和Leaf中,播放時間控制
        public readonly ushort WAIT_USE_TIME = 0;  //按照指定的時間長度播放,到時間就切到下一個
        public readonly ushort WAIT_CHILD    = 1;  //等待子項目的播放,如果到了指定的時間長度,而子項目還沒有播完,則等待播完

        //整形TRUE/FALSE值
        public readonly Int32 V_FALSE = 0;
        public readonly Int32 V_TRUE  = 1;

        //顯示屏基色類型
        public readonly Int32 COLOR_MODE_MONO       = 1;  //單色
        public readonly Int32 COLOR_MODE_DOUBLE     = 2;  //雙色
        public readonly Int32 COLOR_MODE_FULL_16BIT = 3;  //16位全彩
        public readonly Int32 COLOR_MODE_FULL_32BIT = 4;  //32位全彩

        //顯示數據命令
        public readonly Int32 ROOT_UPDATE       = 0x13;  //更新下位機程序
        public readonly Int32 ROOT_FONTSET      = 0x14;  //下載字庫
        public readonly Int32 ROOT_PLAY         = 0x21;  //節目數據,保存到RAM,掉電丟失-
        public readonly Int32 ROOT_DOWNLOAD     = 0x22;  //節目數據,保存到Flash
        public readonly Int32 ROOT_PLAY_CHAPTER = 0x23;  //插入或者更新某一節目
        public readonly Int32 ROOT_PLAY_REGION  = 0x25;  //插入或者更新某一區域/分區
        public readonly Int32 ROOT_PLAY_LEAF    = 0x27;  //插入或者更新某一頁面
        public readonly Int32 ROOT_PLAY_OBJECT  = 0x29;  //插入或者更新某一對象

        public readonly Int32 ACTMODE_INSERT    = 0;     //插入操作
        public readonly Int32 ACTMODE_REPLACE   = 1;     //替換操作

        //RAM節目播放
        public readonly Int32 SURVIVE_ALWAYS = -1;

        //Windows字體類型定義
        public readonly Int32 WFS_NONE      = 0x0;   //普通樣式
        public readonly Int32 WFS_BOLD      = 0x01;  //粗體
        public readonly Int32 WFS_ITALIC    = 0x02;  //斜體
        public readonly Int32 WFS_UNDERLINE = 0x04;  //下划線
        public readonly Int32 WFS_STRIKEOUT = 0x08;  //刪除線

        //內碼文字大小
        public readonly Int32 FONT_SET_16 = 0;      //16點陣字符
        public readonly Int32 FONT_SET_24 = 1;      //24點陣字符
 
        //正計時、倒計時type參數
        public readonly Int32 CT_COUNTUP   = 0;      //正計時
        public readonly Int32 CT_COUNTDOWN = 1;      //倒計時
        public readonly Int32 CT_COUNTUP_EX = 2;     //倒計時
        public readonly Int32 CT_COUNTDOWN_EX = 3;   //倒計時
       
        //正計時、倒計時format參數
        public readonly Int32 CF_HNS    = 0;      //時分秒(相對值)
        public readonly Int32 CF_HN     = 1;      //時分(相對值)
        public readonly Int32 CF_NS     = 2;      //分秒(相對值)
        public readonly Int32 CF_H      = 3;      //時(相對值)
        public readonly Int32 CF_N      = 4;      //分(相對值)
        public readonly Int32 CF_S      = 5;      //秒(相對值)
        public readonly Int32 CF_DAY    = 6;      //天數(絕對數量)
        public readonly Int32 CF_HOUR   = 7;      //小時數(絕對數量)
        public readonly Int32 CF_MINUTE = 8;     //分鍾數(絕對數量)
        public readonly Int32 CF_SECOND = 9;      //秒數(絕對數量)

        //模擬時鍾邊框形狀
        public readonly Int32 SHAPE_RECTANGLE = 0;      //方形
        public readonly Int32 SHAPE_ROUNDRECT = 1;      //圓角方形
        public readonly Int32 SHAPE_CIRCLE    = 2;      //圓形

        ////////////////////////////////////////////////////////////////////////////////////////////
        //接口函數導入
        ////////////////////////////////////////////////////////////////////////////////////////////

        //動態鏈接庫初始化
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Startup();

        //動態鏈接庫銷毀
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Cleanup();

        //創建控制卡在線監聽服務
        //  serverindex 控制卡在線監聽服務編號(可以在多個socket udp端口監聽)
        //  localport 本地端口
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Report_CreateServer(Int32 serverindex, Int32 localport);

        //刪除控制卡在線監聽服務
        //  serverindex 控制卡在線監聽服務編號
        [DllImport("LEDSender2010.dll")]
        private static extern void LED_Report_RemoveServer(Int32 serverindex);

        //刪除全部控制卡在線監聽服務
        [DllImport("LEDSender2010.dll")]
        private static extern void LED_Report_RemoveAllServer();

        //獲得控制卡在線列表
        //必須先創建控制卡在線監聽服務,即調用LED_Report_CreateServer后使用,否則返回值無效
        //  serverindex 控制卡在線監聽服務編號
        //  plist 輸出在線列表的用戶外部緩沖區,
        //        如果傳入空(NULL/0),則輸出到動態鏈接庫內部的緩沖區,繼續調用下面的接口取得詳細信息
        //  count 最大讀取個數
        //--返回值-- 小於0表示失敗(未創建該在線監聽服務),大於等於0表示在線的控制卡數量
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Report_GetOnlineList(Int32 serverindex, Int32 listaddr, Int32 count);

        //獲得某個在線控制卡的上報控制卡名稱
        //必須先創建控制卡在線監聽服務,即調用LED_Report_CreateServer后使用,否則返回值無效
        //  serverindex 控制卡在線監聽服務編號
        //  itemindex 該監聽服務的在線列表中,在線控制卡的編號
        //--返回值-- 在線控制卡的上報控制卡名稱
        [DllImport("LEDSender2010.dll")]
        private static extern String LED_Report_GetOnlineItemName(Int32 serverindex, Int32 itemindex);

        //獲得某個在線控制卡的上報控制卡IP地址
        //必須先創建控制卡在線監聽服務,即調用LED_Report_CreateServer后使用,否則返回值無效
        //  serverindex 控制卡在線監聽服務編號
        //  itemindex 該監聽服務的在線列表中,在線控制卡的編號
        //--返回值-- 在線控制卡的IP地址
        [DllImport("LEDSender2010.dll")]
        private static extern String LED_Report_GetOnlineItemHost(Int32 serverindex, Int32 itemindex);

        //獲得某個在線控制卡的上報控制卡遠程UDP端口號
        //必須先創建控制卡在線監聽服務,即調用LED_Report_CreateServer后使用,否則返回值無效
        //  serverindex 控制卡在線監聽服務編號
        //  itemindex 該監聽服務的在線列表中,在線控制卡的編號
        //--返回值-- 在線控制卡的遠程UDP端口號
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Report_GetOnlineItemPort(Int32 serverindex, Int32 itemindex);

        //獲得某個在線控制卡的上報控制卡地址
        //必須先創建控制卡在線監聽服務,即調用LED_Report_CreateServer后使用,否則返回值無效
        //  serverindex 控制卡在線監聽服務編號
        //  itemindex 該監聽服務的在線列表中,在線控制卡的編號
        //--返回值-- 在線控制卡的硬件地址
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_Report_GetOnlineItemAddr(Int32 serverindex, Int32 itemindex);

        //動態鏈接庫銷毀
        [DllImport("LEDSender2010.dll")]
        private static extern void LED_Preview(Int32 index, Int32 width, Int32 height, string previewfile);

        //設置每次命令執行完成后,是否關閉設備。=0表示不關閉;=1表示關閉。
        [DllImport("LEDSender2010.dll")]
        private static extern void LED_CloseDeviceOnTerminate(int AValue);

        //獲取控制卡應答結果的數據
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_GetNotifyParam(ref TNotifyParam param, Int32 index);
       
        //復位控制卡節目播放,重新顯示控制卡Flash中存儲的節目
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_ResetDisplay(ref TSenderParam param);

        //設置控制卡電源 value=LED_POWER_ON表示開啟電源 value=LED_POWER_OFF表示關閉電源
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_SetPower(ref TSenderParam param, Int32 value);

        //讀取控制卡電源狀態
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_GetPower(ref TSenderParam param);

        //設置控制卡亮度 value取值范圍0-7
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_SetBright(ref TSenderParam param, Int32 value);

        //讀取控制卡亮度
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_GetBright(ref TSenderParam param);

        //校正時間,以當前計算機的系統時間校正控制卡的時鍾
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_AdjustTime(ref TSenderParam param);

        //校正時間擴展,以指定的時間校正控制卡的時鍾
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_AdjustTimeEx(ref TSenderParam param, ref TSystemTime time);

        //發送節目數據 index為MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject函數的返回值
        [DllImport("LEDSender2010.dll")]
        private static extern int LED_SendToScreen(ref TSenderParam param, Int32 index);

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //節目數據組織形式
        //  ROOT
        //   |
        //   |---Chapter(節目)
        //   |      |
        //   |      |---Region(區域/分區)
        //   |      |     |
        //   |      |     |---Leaf(頁面)
        //   |      |     |    |
        //   |      |     |    |---Object(對象[文字、時鍾、圖片等])
        //   |      |     |    |
        //   |      |     |    |---Object(對象[文字、時鍾、圖片等])
        //   |      |     |    |
        //   |      |     |    |   ......
        //   |      |     |    |
        //   |      |     |
        //   |      |     |---Leaf(頁面)
        //   |      |     |
        //   |      |     |   ......
        //   |      |     |
        //   |      |
        //   |      |---Region(區域/分區)
        //   |      |
        //   |      |   ......
        //   |      |
        //   |---Chapter(節目)
        //   |
        //   |   ......

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //生成節目數據(從VisionShow軟件編輯的Vsq文件載入,並生成要下發的節目數據)
        //  RootType 為節目類型;=ROOT_PLAY表示更新控制卡RAM中的節目(掉電丟失);=ROOT_DOWNLOAD表示更新控制卡Flash中的節目(掉電不丟失)
        //  ColorMode 為顏色模式;取值為COLOR_MODE_MONO或者COLOR
        //  survive 為RAM節目生存時間,在RootType=ROOT_PLAY時有效,當RAM節目播放達到時間后,恢復顯示FLASH中的節目
        //  filename 由VisionShow軟件編輯的節目文件
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeFromVsqFile(string filename, Int32 RootType, Int32 ColorMode, Int32 survive);

        //生成節目數據
        //  RootType 為節目類型;=ROOT_PLAY表示更新控制卡RAM中的節目(掉電丟失);=ROOT_DOWNLOAD表示更新控制卡Flash中的節目(掉電不丟失)
        //  ColorMode 為顏色模式;取值為COLOR_MODE_MONO或者COLOR
        //  survive 為RAM節目生存時間,在RootType=ROOT_PLAY時有效,當RAM節目播放達到時間后,恢復顯示FLASH中的節目
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeRoot(Int32 RootType, Int32 ColorMode, Int32 survive);

        //生成節目數據,后續需要調用[AddRegion]->[AddLeaf]->[AddObject]->[AddWindows/AddDateTime等]
        //  RootType 必須設為ROOT_PLAY_CHAPTER
        //  ActionMode 必須設為0
        //  ChapterIndex 要更新的節目序號
        //  ColorMode 同MakeRoot中的定義
        //  time 播放的時間長度
        //  wait 等待模式,=WAIT_CHILD,表示當達到播放時間長度時,需要等待子節目播放完成再切換;
        //                 =WAIT_USE_TIME,表示當達到播放時間長度時,不等待子節目播放完成,直接切換下一節目
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeChapter(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 ColorMode, UInt32 time, ushort wait);

        //生成區域/分區,后續需要調用[AddLeaf]->[AddObject]->[AddWindows/AddDateTime等]
        //  RootType 必須設為ROOT_PLAY_REGION
        //  ActionMode 必須設為0
        //  ChapterIndex 要更新的節目序號
        //  RegionIndex 要更新的區域/分區序號
        //  ColorMode 同MakeRoot中的定義
        //  left、top、width、height 左、上、寬度、高度
        //  border 流水邊框
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeRegion(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex,
            Int32 ColorMode, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border);

        //生成頁面,后續需要調用[AddObject]->[AddWindows/AddDateTime等]
        //  RootType 必須設為ROOT_PLAY_LEAF
        //  ActionMode 必須設為0
        //  ChapterIndex 要更新的節目序號
        //  RegionIndex 要更新的區域/分區序號
        //  LeafIndex 要更新的頁面序號
        //  ColorMode 同MakeRoot中的定義
        //  time 播放的時間長度
        //  wait 等待模式,=WAIT_CHILD,表示當達到播放時間長度時,需要等待子節目播放完成再切換;
        //                 =WAIT_USE_TIME,表示當達到播放時間長度時,不等待子節目播放完成,直接切換下一頁面
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeLeaf(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex,
            Int32 ColorMode, UInt32 time, ushort wait);

        //生成播放對象,后續需要調用[AddWindows/AddDateTime等]
        //  RootType 必須設為ROOT_PLAY_LEAF
        //  ActionMode 必須設為0
        //  ChapterIndex 要更新的節目序號
        //  RegionIndex 要更新的區域/分區序號
        //  LeafIndex 要更新的頁面序號
        //  ObjectIndex 要更新的對象序號
        //  ColorMode 同MakeRoot中的定義
        [DllImport("LEDSender2010.dll")]
        private static extern int MakeObject(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex, Int32 ObjectIndex, Int32 ColorMode);

        //添加節目
        //  num 節目數據緩沖區編號,是MakeRoot的返回值
        //  time 播放的時間長度(單位為毫秒)
        //  wait 等待模式,=WAIT_CHILD,表示當達到播放時間長度時,需要等待子節目播放完成再切換;
        //                 =WAIT_USE_TIME,表示當達到播放時間長度時,不等待子節目播放完成,直接切換下一節目
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChapter(ushort num, UInt32 time, ushort wait);

        //添加區域/分區
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  border 流水邊框
        [DllImport("LEDSender2010.dll")]
        private static extern int AddRegion(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border);

        //添加頁面
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion的返回值
        //  time 播放的時間長度(單位為毫秒)
        //  wait 等待模式,=WAIT_CHILD,表示當達到播放時間長度時,需要等待子節目播放完成再切換;
        //                 =WAIT_USE_TIME,表示當達到播放時間長度時,不等待子節目播放完成,直接切換下一頁面
        [DllImport("LEDSender2010.dll")]
        private static extern int AddLeaf(ushort num, UInt32 time, ushort wait);

        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //添加日期時間顯示
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  year_offset 年偏移量
        //  month_offset 月偏移量
        //  day_offset 日偏移量
        //  sec_offset 秒偏移量
        //  format 顯示格式
        //      #y表示年 #m表示月 #d表示日 #h表示時 #n表示分 #s表示秒 #w表示星期 #c表示農歷
        //      舉例: format="#y年#m月#d日 #h時#n分#s秒 星期#w 農歷#c"時,顯示為"2009年06月27日 12時38分45秒 星期六 農歷五月初五"
        [DllImport("LEDSender2010.dll")]
        private static extern int AddDateTime(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
      string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle,
            Int32 year_offset, Int32 month_offset, Int32 day_offset, Int32 sec_offset, string format);

        //添加作戰時間顯示
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  format 顯示格式
        //      #y表示年 #m表示月 #d表示日 #h表示時 #n表示分 #s表示秒 #w表示星期
        //  basetime 作戰時間
        //  fromtime 開始時間
        //  totime 結束時間
        //  step 計時走秒時間步長(多少毫秒走一秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddCampaignEx(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle,
            string format, ref TTimeStamp basetime, ref TTimeStamp fromtime, ref TTimeStamp totime, Int32 step);

        //添加倒計時顯示
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  countertype 計時類型 0(CT_COUNTUP)為正計時,1(CT_COUNTDOWN)為倒計時
        //  format 顯示格式
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  basetime 作戰時間
        [DllImport("LEDSender2010.dll")]
        private static extern int AddCounter(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, Int32 countertype, Int32 format,
            string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, ref TTimeStamp basetime);

        //添加模擬時鍾
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  offset 秒偏移量
        //  bkcolor: 背景顏色
        //  bordercolor: 邊框顏色
        //  borderwidth: 邊框顏色
        //  bordershape: 邊框形狀 =0表示正方形;=1表示圓角方形;=2表示圓形
        //  dotradius: 刻度距離表盤中心半徑
        //  adotwidth: 0369點刻度大小
        //  adotcolor: 0369點刻度顏色
        //  bdotwidth: 其他點刻度大小
        //  bdotcolor: 其他點刻度顏色
        //  hourwidth: 時針粗細
        //  hourcolor: 時針顏色
        //  minutewidth: 分針粗細
        //  minutecolor: 分針顏色
        //  secondwidth: 秒針粗細
        //  secondcolor: 秒針顏色
        [DllImport("LEDSender2010.dll")]
        private static extern int AddClock(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, Int32 offset,
      UInt32 bkcolor, UInt32 bordercolor, UInt32 borderwidth, Int32 bordershape,
      Int32 dotradius, Int32 adotwidth, UInt32 adotcolor, Int32 bdotwidth, UInt32 bdotcolor,
            Int32 hourwidth, UInt32 hourcolor, Int32 minutewidth, UInt32 minutecolor, Int32 secondwidth, UInt32 secondcolor);

        //添加動畫
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  filename avi文件名
        //  stretch: 圖像是否拉伸以適應對象大小
        [DllImport("LEDSender2010.dll")]
        private static extern int AddMovie(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, string filename, Int32 stretch);

        //添加圖片組播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddWindows(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border);

        //添加圖片組的子圖片 此函數要跟在AddWindows后面調用
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  dc 源圖片DC句柄
        //  width 圖片寬度
        //  height 圖片高度
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChildWindow(ushort num, UInt32 dc, Int32 width, Int32 height, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加圖片組的子圖片 此函數要跟在AddWindows后面調用
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  filename 圖片文件名
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChildPicture(ushort num, string filename, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加圖片組的子圖片 此函數要跟在AddWindows后面調用
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  str 文字字符串
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  wordwrap 是否自動換行 =1自動換行;=0不自動換行
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChildText(ushort num, string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加圖片組的子圖片 此函數要跟在AddWindows后面調用
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  str 文字字符串
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  wordwrap 是否自動換行 =1自動換行;=0不自動換行
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChildTextEx(ushort num, string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 autofitsize, Int32 wordwrap, Int32 vertical, Int32 alignment,Int32 verticalspace, Int32 horizontalfit,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加內碼文字組播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddStrings(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border);

        //添加圖片組的子圖片 此函數要跟在AddWindows后面調用
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  str 文字字符串
        //  fontset 字庫 =FONTSET_16P表示16點陣字庫;=FONTSET_24P表示24點陣字庫
        //  color 顏色
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddChildString(ushort num, string str, Int32 fontset, Int32 color,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加圖片點陣播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  dc 源圖片DC句柄
        //  src_width 圖片寬度
        //  src_height 圖片高度
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddWindow(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
      UInt32 dc, Int32 src_width, Int32 src_height, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加圖片文件播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  filename 圖片文件
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddPicture(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, string filename, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加文字播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  str 文字字符串
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  wordwrap 是否自動換行 =1自動換行;=0不自動換行
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddText(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
      string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment,
      Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加文字播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  str 文字字符串
        //  fontname 字體名稱
        //  fontsize 字體大小
        //  fontcolor 字體顏色
        //  fontstyle 字體樣式 舉例:=WFS_BOLD表示粗體;=WFS_ITALIC表示斜體;=WFS_BOLD+WFS_ITALIC表示粗斜體
        //  wordwrap 是否自動換行 =1自動換行;=0不自動換行
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddTextEx3(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 flag,
            string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 bkcolor, Int32 autofitsize, Int32 wordwrap,
            Int32 vertical, Int32 alignment, Int32 verticalspace, Int32 horizontalfit,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        //添加內碼文字播放
        //  num 節目數據緩沖區編號,是MakeRoot、MakeChapter、MakeRegion、MakeLeaf、MakeObject的返回值
        //  left、top、width、height 左、上、寬度、高度
        //  transparent 是否透明 =1表示透明;=0表示不透明
        //  border 流水邊框(未實現)
        //  str 文字字符串
        //  fontset 字庫 =FONTSET_16P表示16點陣字庫;=FONTSET_24P表示24點陣字庫
        //  color 顏色
        //  inmethod 引入方式(下面有列表說明)
        //  inspeed 引入速度(取值范圍0-5,從快到慢)
        //  outmethod 引出方式(下面有列表說明)
        //  outspeed 引出速度(取值范圍0-5,從快到慢)
        //  stopmethod 停留方式(下面有列表說明)
        //  stopspeed 停留速度(取值范圍0-5,從快到慢)
        //  stoptime 停留時間(單位毫秒)
        [DllImport("LEDSender2010.dll")]
        private static extern int AddString(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
      string str, Int32 fontset, Int32 color,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime);

        // ====引入動作方式列表(數值從0開始)====
        //    0 = '隨機',
        //    1 = '立即顯示',
        //    2 = '左滾顯示',
        //    3 = '上滾顯示',
        //    4 = '右滾顯示',
        //    5 = '下滾顯示',
        //    6 = '連續左滾顯示',
        //    7 = '連續下滾顯示',
        //    8 = '中間向上下展開',
        //    9 = '中間向兩邊展開',
        //   10 = '中間向四周展開',
        //   11 = '從右向左移入',
        //   12 = '從左向右移入',
        //   13 = '從左向右展開',
        //   14 = '從右向左展開',
        //   15 = '從右上角移入',
        //   16 = '從右下角移入',
        //   17 = '從左上角移入',
        //   18 = '從左下角移入',
        //   19 = '從上向下移入',
        //   20 = '從下向上移入',
        //   21 = '橫向百葉窗',
        //   22 = '縱向百葉窗',
        // =====================================

        // ====引出動作方式列表(數值從0開始)====
        //    0 = '隨機',
        //    1 = '不消失',
        //    2 = '立即消失',
        //    3 = '上下向中間合攏',
        //    4 = '兩邊向中間合攏',
        //    5 = '四周向中間合攏',
        //    6 = '從左向右移出',
        //    7 = '從右向左移出',
        //    8 = '從右向左合攏',
        //    9 = '從左向右合攏',
        //   10 = '從右上角移出',
        //   11 = '從右下角移出',
        //   12 = '從左上角移出',
        //   13 = '從左下角移出',
        //   14 = '從下向上移出',
        //   15 = '從上向下移出',
        //   16 = '橫向百葉窗',
        //   17 = '縱向百葉窗'
        // =====================================

        // ====停留動作方式列表(數值從0開始)====
        //    0 = '靜態顯示',
        //    1 = '閃爍顯示'
        // =====================================

        public int Do_LED_Startup()
        {
            return LED_Startup();
        }

        public int Do_LED_Cleanup()
        {
            return LED_Cleanup();
        }

        public int Do_LED_Report_CreateServer(Int32 serverindex, Int32 localport)
        {
            return LED_Report_CreateServer(serverindex, localport);
        }

        public void Do_LED_Report_RemoveServer(Int32 serverindex)
        {
            LED_Report_RemoveServer(serverindex);
        }

        public void Do_LED_Report_RemoveAllServer()
        {
            LED_Report_RemoveAllServer();
        }

        public int Do_LED_Report_GetOnlineList(Int32 serverindex)
        {
            return LED_Report_GetOnlineList(serverindex, 0, 0);
        }

        public String Do_LED_Report_GetOnlineItemName(Int32 serverindex, Int32 itemindex)
        {
            return LED_Report_GetOnlineItemName(serverindex, itemindex);
        }

        public String Do_LED_Report_GetOnlineItemHost(Int32 serverindex, Int32 itemindex)
        {
            return LED_Report_GetOnlineItemHost(serverindex, itemindex);
        }

        public int Do_LED_Report_GetOnlineItemPort(Int32 serverindex, Int32 itemindex)
        {
            return LED_Report_GetOnlineItemPort(serverindex, itemindex);
        }

        public int Do_LED_Report_GetOnlineItemAddr(Int32 serverindex, Int32 itemindex)
        {
            return LED_Report_GetOnlineItemAddr(serverindex, itemindex);
        }

        public void Do_LED_Preview(Int32 index, Int32 width, Int32 height, string previewfile)
        {
            LED_Preview(index, width, height, previewfile);
        }

        public void Do_LED_CloseDeviceOnTerminate(int AValue)
        {
            LED_CloseDeviceOnTerminate(AValue);
        }

        public int Do_LED_GetNotifyParam(ref TNotifyParam param, Int32 index)
        {
            return LED_GetNotifyParam(ref param, index);
        }

        public int Do_LED_ResetDisplay(ref TSenderParam param)
        {
            return LED_ResetDisplay(ref param);
        }

        public int Do_LED_SetPower(ref TSenderParam param, Int32 value)
        {
            return LED_SetPower(ref param, value);
        }

        public int Do_LED_GetPower(ref TSenderParam param)
        {
            return LED_GetPower(ref param);
        }

        public int Do_LED_SetBright(ref TSenderParam param, Int32 value)
        {
            return LED_SetBright(ref param, value);
        }

        public int Do_LED_GetBright(ref TSenderParam param)
        {
            return LED_GetBright(ref param);
        }

        public int Do_LED_AdjustTime(ref TSenderParam param)
        {
            return LED_AdjustTime(ref param);
        }

        public int Do_LED_AdjustTimeEx(ref TSenderParam param, ref TSystemTime time)
        {
            return LED_AdjustTimeEx(ref param, ref time);
        }

        public int Do_LED_SendToScreen(ref TSenderParam param, Int32 index)
        {
            return LED_SendToScreen(ref param, index);
        }

        public int Do_MakeFromVsqFile(string filename, Int32 RootType, Int32 ColorMode, Int32 survive)
        {
            return MakeFromVsqFile(filename, RootType, ColorMode, survive);
        }

        public int Do_MakeRoot(Int32 RootType, Int32 ColorMode, Int32 survive)
        {
            return MakeRoot(RootType, ColorMode, survive);
        }

        public int Do_MakeChapter(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 ColorMode, UInt32 time, ushort wait)
        {
            return MakeChapter(RootType, ActionMode, ChapterIndex, ColorMode, time, wait);
        }

        public int Do_MakeRegion(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex,
            Int32 ColorMode, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border)
        {
            return MakeRegion(RootType, ActionMode, ChapterIndex, RegionIndex, ColorMode, left, top, width, height, border);
        }

        public int Do_MakeLeaf(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex,
            Int32 ColorMode, UInt32 time, ushort wait)
        {
            return MakeLeaf(RootType, ActionMode, ChapterIndex, RegionIndex, LeafIndex, ColorMode, time, wait);
        }

        public int Do_MakeObject(Int32 RootType, Int32 ActionMode, Int32 ChapterIndex, Int32 RegionIndex, Int32 LeafIndex, Int32 ObjectIndex, Int32 ColorMode)
        {
            return MakeObject(RootType, ActionMode, ChapterIndex, RegionIndex, LeafIndex, ObjectIndex, ColorMode);
        }

        public int Do_AddChapter(ushort num, UInt32 time, ushort wait)
        {
            return AddChapter(num, time, wait);
        }

        public int Do_AddRegion(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 border)
        {
            return AddRegion(num, left, top, width, height, border);
        }

        public int Do_AddLeaf(ushort num, UInt32 time, ushort wait)
        {
            return AddLeaf(num, time, wait);
        }

        public int Do_AddDateTime(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle,
            Int32 year_offset, Int32 month_offset, Int32 day_offset, Int32 sec_offset, string format)
        {
            return AddDateTime(num, left, top, width, height, transparent, border, fontname, fontsize, fontcolor, fontstyle,
                year_offset, month_offset, day_offset, sec_offset, format);
        }

        public int Do_AddCampaign(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle,
            string format, ref TTimeStamp basetime, ref TTimeStamp fromtime, ref TTimeStamp totime, Int32 step)
        {
            return AddCampaignEx(num, left, top, width, height, transparent, border, fontname, fontsize, fontcolor, fontstyle,
                format, ref basetime, ref fromtime, ref totime, step);
        }

        public int Do_AddCounter(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, Int32 countertype, Int32 format,
            string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, ref TTimeStamp basetime)
        {
            return AddCounter(num, left, top, width, height, transparent, border, countertype, format, fontname, fontsize, fontcolor, fontstyle, ref basetime);
        }

        public int Do_AddClock(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, Int32 offset,
            UInt32 bkcolor, UInt32 bordercolor, UInt32 borderwidth, Int32 bordershape,
            Int32 dotradius, Int32 adotwidth, UInt32 adotcolor, Int32 bdotwidth, UInt32 bdotcolor,
            Int32 hourwidth, UInt32 hourcolor, Int32 minutewidth, UInt32 minutecolor, Int32 secondwidth, UInt32 secondcolor)
        {
            return AddClock(num, left, top, width, height, transparent, border, offset, bkcolor, bordercolor, borderwidth, bordershape,
                dotradius, adotwidth, adotcolor, bdotwidth, bdotcolor,
                hourwidth, hourcolor, minutewidth, minutecolor, secondwidth, secondcolor);
        }

        public int Do_AddMovie(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, string filename, Int32 stretch)
        {
            return AddMovie(num, left, top, width, height, transparent, border, filename, stretch);
        }

        public int Do_AddWindows(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border)
        {
            return AddWindows(num, left, top, width, height, transparent, border);
        }

        public int Do_AddChildWindow(ushort num, UInt32 dc, Int32 width, Int32 height, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddChildWindow(num, dc, width, height, alignment, inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddChildPicture(ushort num, string filename, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddChildPicture(num, filename, alignment, inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddChildText(ushort num, string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddChildText(num, str, fontname, fontsize, fontcolor, fontstyle, wordwrap, alignment,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddChildTextEx(ushort num, string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment, Int32 verticalspace,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddChildTextEx(num, str, fontname, fontsize, fontcolor, fontstyle, 0, wordwrap, 0, alignment, verticalspace, 0,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddStrings(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border)
        {
            return AddStrings(num, left, top, width, height, transparent, border);
        }

        public int Do_AddChildString(ushort num, string str, Int32 fontset, Int32 color,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddChildString(num, str, fontset, color,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddWindow(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            UInt32 dc, Int32 src_width, Int32 src_height, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddWindow(num, left, top, width, height, transparent, border, dc, src_width, src_height, alignment,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddPicture(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border, string filename, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddPicture(num, left, top, width, height, transparent, border, filename, alignment,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddText(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddText(num, left, top, width, height, transparent, border,
                str, fontname, fontsize, fontcolor, fontstyle, wordwrap, alignment,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddTextEx(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string str, string fontname, Int32 fontsize, Int32 fontcolor, Int32 fontstyle, Int32 wordwrap, Int32 alignment, Int32 verticalspace,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddTextEx3(num, left, top, width, height, transparent, 0,
                str, fontname, fontsize, fontcolor, fontstyle, 0, 0, wordwrap, 0, alignment, verticalspace, 0,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }

        public int Do_AddString(ushort num, Int32 left, Int32 top, Int32 width, Int32 height, Int32 transparent, Int32 border,
            string str, Int32 fontset, Int32 color,
            Int32 inmethod, Int32 inspeed, Int32 outmethod, Int32 outspeed, Int32 stopmethod, Int32 stopspeed, Int32 stoptime)
        {
            return AddString(num, left, top, width, height, transparent, border, str, fontset, color,
                inmethod, inspeed, outmethod, outspeed, stopmethod, stopspeed, stoptime);
        }
    }
}3.自定義的參數結構

/*
 * Created by SharpDevelop.
 * User: gaofajin
 * Date: 2015/10/21
 * Time: 16:10
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;

namespace LedTest
{
 /// <summary>
 /// Description of ParaSet.
 /// </summary>
 public class ParaSet
 {
   int InStyle;
   int InSpeed;
   int OutStyle;
   int OutSpeed;
   int TlStyle;
   int TlSpeed;
   int TlTime;
  
  public  int inStyle
  {
   get{ return InStyle;}   
   set {InStyle=value;}
  }
  public  int inSpeed
  {
   get{ return InSpeed;}   
   set {InSpeed=value;}
  }
  public  int outStyle
  {
   get{ return OutStyle;}   
   set {OutStyle=value;}
  }
  public  int outSpeed
  {
   get{ return OutSpeed;}   
   set {OutSpeed=value;}
  }
  public  int tlStyle
  {
   get{ return TlStyle;}   
   set {TlStyle=value;}
  }
  public  int tlSpeed
  {
   get{ return TlSpeed;}   
   set {TlSpeed=value;}
  }
  public  int tlTime
  {
   get{ return TlTime;}   
   set {TlTime=value;}
  }
 }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM