using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SerialFlash
{
public partial class Form1 : Form
{
public Form1() {
InitializeComponent();
}
private SerialPort ComDevice;
string path = Application.StartupPath + "\\" + "系统文件" + ".txt";
string path1 = System.Windows.Forms.Application.StartupPath + "\\Flash\\" + "1" + ".swf";
string path2 = System.Windows.Forms.Application.StartupPath + "\\Flash\\" + "2" + ".swf";
string path3 = System.Windows.Forms.Application.StartupPath + "\\Flash\\" + "3" + ".swf";
string path4 = System.Windows.Forms.Application.StartupPath + "\\Flash\\" + "4" + ".swf";
string path5 = System.Windows.Forms.Application.StartupPath + "\\Flash\\" + "5" + ".swf";
//声明
string Mode;
string PortName;
string BaudRate;
string ParityBit;
string DataBits;
string StopBit;
private void Form1_Load(object sender, EventArgs e) {
DataRead();//读参数
SerialPortInit();//串口初始化
ComDevice.DataReceived += CD_DataReceived;//从串口读数据
ComDevice.Encoding = Encoding.GetEncoding("GB2312");//支持中文
CheckForIllegalCrossThreadCalls = false;//获取或设置一个值,该值指示是否捕获对错误线程的调用,这些调用在调试应用程序时访问控件的 Handle 属性。
if(this.Mode == "运行") {
axShockwaveFlash1.Movie = path1;
axShockwaveFlash1.Play();
//实现窗体内某控件的全屏显示
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.
串口通讯系列六-串口与上位机通讯调用Flash及Flash视频切换(非交互)
最新推荐文章于 2023-04-27 14:11:23 发布