• 大小: 100KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-05-10
  • 语言: C#
  • 标签: C#  

资源简介

雷赛运动控制卡C#案例。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using csLTDMC;

namespace IO
{
    public partial class Form1 : Form
    {
        private ushort _CardID = 0;
        private ushort _CANStatus = 0;
        private ushort _CANNum = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender EventArgs e)
        {
            short num = LTDMC.dmc_board_init();//获取卡数量
            if (num <= 0 || num > 8)
            {
                MessageBox.Show(“初始卡失败!“ “出错“);
            }
            ushort _num = 0;
            ushort[] cardids = new ushort[8];
            uint[] cardtypes = new uint[8];
            short res = LTDMC.dmc_get_CardInfList(ref _num cardtypes cardids);

            LTDMC.dmc_read_inbit(0 1);

            if (res != 0)
            {
                MessageBox.Show(“获取卡信息失败!“);
            }
            _CardID = cardids[0];
            //
            timer1.Start();
        }

        private Label GetINLabel(int index)
        {
            string txt = index.ToString();
            foreach (Label _label in groupBox1.Controls)
            {
                if (_label != null && _label.Text == txt)
                {
                    return _label;
                }
            }
            return null;
        }
        private Label GetOUTLabel(int index)
        {
            string txt = index.ToString();
            foreach (Label _label in groupBox2.Controls)
            {
                if (_label != null && _label.Text == txt)
                {
                    return _label;
                }
            }
            return null;
        }

        private Label GetCANINLabel(int index)
        {
            string txt = index.ToString();
            foreach (Label _label in groupBox5.Controls)
            {
                if (_label != null && _label.Text == txt)
                {
                    return _label;
                }
            }
            return null;
        }

        private Label GetCANOUTLabel(int index)
        {
            string txt = index.ToString();
            foreach (Label _label in groupBox6.Controls)
            {
                if (_label != null && _label.Text == txt)
                {
                    return _label;
                }
            }
            return null;
        }



        private void SetLabel(Label label bool status)
        {
            if (label != null)
            {
                if (status)
                {
                    label.BackColor = Color.Red;
                }
                else
                {
                    label.BackColor = Color.Green;
                }
            }

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-07-09 08:55  例8_IO\
     目录           0  2019-07-09 08:55  例8_IO\IO\
     文件         187  2017-12-04 00:00  例8_IO\IO\App.config
     文件       56255  2017-12-04 00:00  例8_IO\IO\Form1.Designer.cs
     文件        7579  2017-12-04 00:00  例8_IO\IO\Form1.cs
     文件        6011  2017-12-04 00:00  例8_IO\IO\Form1.resx
     文件        3816  2017-12-04 00:00  例8_IO\IO\IO.csproj
     文件       69703  2017-12-04 00:00  例8_IO\IO\LTDMC.cs
     文件         514  2017-12-04 00:00  例8_IO\IO\Program.cs
     目录           0  2019-07-09 08:55  例8_IO\IO\Properties\
     文件        1334  2017-12-04 00:00  例8_IO\IO\Properties\AssemblyInfo.cs
     文件        2856  2017-12-04 00:00  例8_IO\IO\Properties\Resources.Designer.cs
     文件        5612  2017-12-04 00:00  例8_IO\IO\Properties\Resources.resx
     文件        1089  2017-12-04 00:00  例8_IO\IO\Properties\Settings.Designer.cs
     文件         249  2017-12-04 00:00  例8_IO\IO\Properties\Settings.settings
     目录           0  2019-07-09 08:55  例8_IO\IO\bin\
     目录           0  2019-07-09 08:55  例8_IO\IO\bin\Debug\
     文件       46080  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.exe
     文件         187  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.exe.config
     文件       65024  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.pdb
     文件       22472  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.vshost.exe
     文件         187  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.vshost.exe.config
     文件         490  2017-12-04 00:00  例8_IO\IO\bin\Debug\IO.vshost.exe.manifest
     目录           0  2019-07-09 08:55  例8_IO\IO\obj\
     目录           0  2019-07-09 08:55  例8_IO\IO\obj\Debug\
     文件        1711  2017-12-04 00:00  例8_IO\IO\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        7254  2017-12-04 00:00  例8_IO\IO\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         180  2017-12-04 00:00  例8_IO\IO\obj\Debug\IO.Form1.resources
     文件         180  2017-12-04 00:00  例8_IO\IO\obj\Debug\IO.Properties.Resources.resources
     文件        5538  2017-12-04 00:00  例8_IO\IO\obj\Debug\IO.csproj.FileListAbsolute.txt
     文件         975  2017-12-04 00:00  例8_IO\IO\obj\Debug\IO.csproj.GenerateResource.Cache
............此处省略9个文件信息

评论

共有 条评论