• 大小: 141KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-13
  • 语言: C#
  • 标签: 串口通信  C#  

资源简介

通过C#实现串口通信,里面的代码展示了如何监听计算机中的串口,解析数据或者发送数据,做串口开发的可以参考

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;

namespace PCComm
{
    partial class AboutBox : Form
    {
        public AboutBox()
        {
            InitializeComponent();

            //  Initialize the AboutBox to display the product information from the assembly information.
            //  Change assembly information settings for your application through either:
            //  - Project->Properties->Application->Assembly Information
            //  - AssemblyInfo.cs
            this.Text = String.Format(“About {0}“ Assemblytitle);
            this.labelProductName.Text = AssemblyProduct;
            this.labelVersion.Text = String.Format(“Version {0}“ AssemblyVersion);
            this.labelCopyright.Text = AssemblyCopyright;
            this.labelCompanyName.Text = AssemblyCompany;
            this.textBoxDescription.Text = AssemblyDescription;
        }

        #region Assembly Attribute Accessors

        public string Assemblytitle
        {
            get
            {
                // Get all title attributes on this assembly
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblytitleAttribute) false);
                // If there is at least one title attribute
                if (attributes.Length > 0)
                {
                    // Select the first one
                    AssemblytitleAttribute titleAttribute = (AssemblytitleAttribute)attributes[0];
                    // If it is not an empty string return it
                    if (titleAttribute.title != ““)
                        return titleAttribute.title;
                }
                // If there was no title attribute or if the title attribute was the empty string return the .exe name
                return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Codebase);
            }
        }

        public string AssemblyVersion
        {
            get
            {
                return Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }

        public string AssemblyDescription
        {
            get
            {
                // Get all Description attributes on this assembly
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute) false);
                // If there aren‘t any Description attributes return an empty string
                if (attributes.Length == 0)
                    return ““;
                // If there is a Description attribute return its value
                return ((AssemblyDescriptionAttribute)attributes[0]).Description;
            }
        }

        public string AssemblyProduct
        {
            get
            {
                // Get all P

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

     文件       4884  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.cs

     文件      10533  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.Designer.cs

     文件      49720  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\AboutBox.resx

     文件       1276  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\app.config

     文件      13851  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\CommunicationManager.cs

     文件       3967  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.cs

     文件      31481  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.Designer.cs

     文件      15028  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\frmMain.resx

     文件        475  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Program.cs

     文件       1352  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\AssemblyInfo.cs

     文件       3086  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Resources.Designer.cs

     文件       6197  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Resources.resx

     文件       3309  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Settings.Designer.cs

     文件        927  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Properties\Settings.settings

     文件       3774  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Resources\serial.ico

     文件       3899  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\SerialPortCommunication.csproj

     文件       1255  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication\Settings.cs

     文件        958  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication.sln

    ..A..H.     17408  2011-11-28 01:28  SerialPort-master\SerialPort-master\Backup\SerialPortCommunication.suo

    .......        50  2011-11-28 01:28  SerialPort-master\SerialPort-master\README

    .......      4884  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.cs

    .......     10533  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.Designer.cs

    .......     49720  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\AboutBox.resx

    .......      1276  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\app.config

     文件       1276  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.exe.config

     文件      11608  2015-03-30 15:03  SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe

     文件       1276  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe.config

     文件        490  2010-03-17 22:39  SerialPort-master\SerialPort-master\SerialPortCommunication\bin\Release\SerialPortCommunication.vshost.exe.manifest

    .......     13851  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\CommunicationManager.cs

    .......      3967  2011-11-28 01:28  SerialPort-master\SerialPort-master\SerialPortCommunication\frmMain.cs

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

评论

共有 条评论