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 SerialVideo
{
public partial class Form1 : Form, IMessageFilter
{
public Form1() {
InitializeComponent();
Application.AddMessageFilter(this);
if(this.Mode == "运行") {
//axWindowsMediaPlayer1.URL = pathV1;
//axWindowsMediaPlayer1.Ctlcontrols.play();
this.axWindowsMediaPlayer1.uiMode = "none";
this.axWindowsMediaPlayer1.stretchToFit = true;
this.FormBorderStyle = FormBorderStyle.None;//窗体边框的样式
this.WindowState = FormWindowState.Maximized;//窗体最大化
Rectangle rect = Screen.GetWorkingArea(this);//获取最大化区域
this.axWindowsMediaPlayer1.ClientSize = new Size(rect.Width, rect.Height);//工作区域
this.axWindowsMediaPlayer1.Dock = DockStyle.Fill;
this.axWindowsMediaPlayer1.BringToFront();
//最大化窗体
//this.FormBorderStyle = FormBorderStyle.None;
//this.WindowState = FormWindowState.Maximized;
}
else {
//axWindowsMediaPlayer1.URL = pathV1;
//axWindowsMediaPlayer1.Ctlcontrols.play();
this.axWindowsMediaPlayer1.Dock = DockStyle.None;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
this.WindowState = FormWindowState.Normal;
this.ClientSize = new Size(385, 373);
this.axWindowsMediaPlayer1.Location = new Point(13, 13);//初始位置
this.axWindowsMediaPlayer1.ClientSize = new Size(259, 236);//即是控件的原始尺寸
//最小化窗体
//if(this.WindowState == FormWindowState.Maximized) {
// this.WindowState = FormWindowState.Normal;
//}
}
}
private SerialPort ComDevice;
string path = Application.StartupPath + "\\" + "系统文件" + ".txt";
string pathV1 = Application.StartupPath + "\\Video\\" + "1" + ".avi";
string pathV2 = Application.StartupPath + "\\Video
串口通讯系列五-串口与上位机通讯调用及视频切换
最新推荐文章于 2024-05-13 09:40:37 发布