• 大小: 0.06M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-03-27
  • 语言: C#
  • 标签: c#  

资源简介


用于C#winform开发,接收串口扫描枪的数据读取,以及其它串口设备的设置

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.Threading;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace scanner
{
    /// 
    /// 扫描枪工作类
    /// 

    class CommBar
    {
        //串口引用
        public SerialPort serialPort;

        //存储转换的数据值
        public string Code { get; set; }

        public CommBar()
        {
            serialPort = new SerialPort();
        }

        //串口状态
        public bool IsOpen
        {
            get
            {
                return serialPort.IsOpen;
            }
        }

        //打开串口
        public bool Open()
        {
            if (serialPort.IsOpen)
            {
                Close();
            }
            serialPort.Open();
            if (serialPort.IsOpen)
            {
                return true;
            }
            else
            {
       

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    ..A..H.     47104  2018-05-09 17:29  扫描枪接收测试\scanner\.vs\scanner\v14\.suo

    ..A..H.     49152  2018-05-02 16:14  扫描枪接收测试\scanner\scanner\.vs\scanner\v14\.suo

     文件        189  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\App.config

     文件      12288  2018-05-02 16:12  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.exe

     文件        189  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.exe.config

     文件      26112  2018-05-02 16:12  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.pdb

     文件      22696  2018-05-09 08:50  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.vshost.exe

     文件        189  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.vshost.exe.config

     文件        490  2015-06-04 12:48  扫描枪接收测试\scanner\scanner\bin\Debug\scanner.vshost.exe.manifest

     文件       3842  2018-05-09 09:44  扫描枪接收测试\scanner\scanner\CommBar.cs

     文件       3307  2018-05-09 09:45  扫描枪接收测试\scanner\scanner\Form1.cs

     文件       5711  2018-05-02 15:19  扫描枪接收测试\scanner\scanner\Form1.Designer.cs

     文件       5817  2018-05-02 15:19  扫描枪接收测试\scanner\scanner\Form1.resx

     文件        868  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7124  2018-05-02 14:39  扫描枪接收测试\scanner\scanner\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1425  2018-05-09 08:50  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.csproj.FileListAbsolute.txt

     文件       1012  2018-05-02 15:19  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.csproj.GenerateResource.Cache

     文件       2384  2018-05-02 14:31  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.csprojResolveAssemblyReference.cache

     文件      12288  2018-05-02 16:12  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.exe

     文件        180  2018-05-02 15:19  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.Form1.resources

     文件      26112  2018-05-02 16:12  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.pdb

     文件        180  2018-05-02 14:31  扫描枪接收测试\scanner\scanner\obj\Debug\scanner.Properties.Resources.resources

     文件          0  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件        519  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\Program.cs

     文件       1322  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\Properties\AssemblyInfo.cs

     文件       2827  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\Properties\Resources.Designer.cs

     文件       5612  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\Properties\Resources.resx

     文件       1094  2018-05-02 14:22  扫描枪接收测试\scanner\scanner\Properties\Settings.Designer.cs

............此处省略22个文件信息

评论

共有 条评论