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

资源简介

在SerialPort控件的属性列表中主要注意3个地方: (1)PortName:表示要打开的通信端口名称; (2)BaudRate:表示端口的波特率; (3)ReceivedBytesThreshold:表示触发SerialPort控件的DataReceived事件前输入缓冲区里的字节数; 是串口通信很好的实例,里面包含了很多细节

资源截图

代码片段和文件信息

#region Namespace Inclusions
using System;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
#endregion

namespace SerialPortTerminal
{
  public partial class frmAbout : Form
  {
    private string TempFile = Path.GetTempFileName();

    public frmAbout()
    {
      InitializeComponent();
      
      // Read the about HTML from the assembly
      string html = (new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(“SerialPortTerminal.About.htm“))).ReadToEnd();

      // Replace sections with appropriate data
      html = html.Replace(“{version}“ Assembly.GetExecutingAssembly().GetName().Version.ToString());

      // Save the temp file so the web browser has a target to navigate to
      File.WriteAllText(TempFile html);

      // Show the temp about file 
      web.Navigate(TempFile);
    }

    private void web_Navigated(object sender WebBrowserNavigatedEventArgs e)
    {
      // Since the navigation is complete delete the temp file
      File.Delete(TempFile);
    }
  }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-11-14 10:30  C#_SerialPort---非常好用\
     文件        1228  2009-03-21 15:39  C#_SerialPort---非常好用\About.cs
     文件        2170  2005-03-23 16:21  C#_SerialPort---非常好用\About.Designer.cs
     文件        1132  2005-03-23 16:26  C#_SerialPort---非常好用\About.htm
     文件        5647  2005-03-23 16:19  C#_SerialPort---非常好用\About.resx
     文件        1916  2005-03-23 16:52  C#_SerialPort---非常好用\app.config
     文件        1078  2005-03-23 15:21  C#_SerialPort---非常好用\App.ico
     目录           0  2016-11-14 10:30  C#_SerialPort---非常好用\Backup\
     文件        1228  2009-03-21 15:39  C#_SerialPort---非常好用\Backup\About.cs
     文件        2170  2005-03-23 16:21  C#_SerialPort---非常好用\Backup\About.Designer.cs
     文件        1132  2005-03-23 16:26  C#_SerialPort---非常好用\Backup\About.htm
     文件        5647  2005-03-23 16:19  C#_SerialPort---非常好用\Backup\About.resx
     文件        1916  2005-03-23 16:52  C#_SerialPort---非常好用\Backup\App.config
     文件        1078  2005-03-23 15:21  C#_SerialPort---非常好用\Backup\App.ico
     文件         378  2011-08-10 14:12  C#_SerialPort---非常好用\Backup\Program.cs
     目录           0  2016-11-14 10:30  C#_SerialPort---非常好用\Backup\Properties\
     文件        1283  2005-03-13 14:14  C#_SerialPort---非常好用\Backup\Properties\AssemblyInfo.cs
     文件        3490  2005-03-13 14:15  C#_SerialPort---非常好用\Backup\Properties\Resources.Designer.cs
     文件        5612  2005-03-13 14:14  C#_SerialPort---非常好用\Backup\Properties\Resources.resx
     文件        3877  2005-03-23 16:52  C#_SerialPort---非常好用\Backup\Properties\Settings.Designer.cs
     文件        1140  2005-03-23 16:52  C#_SerialPort---非常好用\Backup\Properties\Settings.settings
     文件        3579  2011-08-10 13:40  C#_SerialPort---非常好用\Backup\SerialPort Terminal.csproj
     文件         616  2011-08-10 13:40  C#_SerialPort---非常好用\Backup\SerialPort Terminal.csproj.user
     文件         926  2009-03-21 15:43  C#_SerialPort---非常好用\Backup\SerialPort Terminal.sln
     文件       22016  2011-08-19 15:04  C#_SerialPort---非常好用\Backup\SerialPort Terminal.v12.suo
     文件       10883  2011-08-10 14:47  C#_SerialPort---非常好用\Backup\Terminal.cs
     文件       16029  2011-08-10 13:44  C#_SerialPort---非常好用\Backup\Terminal.Designer.cs
     文件        7730  2011-08-10 13:44  C#_SerialPort---非常好用\Backup\Terminal.resx
     目录           0  2016-11-14 10:30  C#_SerialPort---非常好用\bin\
     目录           0  2016-11-14 10:30  C#_SerialPort---非常好用\bin\Debug\
     文件       26624  2016-06-17 13:46  C#_SerialPort---非常好用\bin\Debug\SerialPort Terminal.exe
............此处省略52个文件信息

评论

共有 条评论