代码拉取完成,页面将自动刷新
同步操作将从 13799673123/myIPC 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace UltrasonicTDPlatform
{
/**
* 主菜单窗口类
*/
public partial class MainMenu : Form
{
[DllImport("dllTest.dll", CallingConvention = CallingConvention.Cdecl)]
extern static int Sum(int a, int b);
/**
* 子窗体变量
*/
//1.欢迎页窗体
public static WelcomeForm welcomeForm = new WelcomeForm();
//2.扫描窗体(这里不能直接初始化,否则Mainmenu的值传递不过去,等到按下“阻抗测量”时,再初始化,就可把以及设置好的值传递给SweepForm)
public static SweepForm sweepForm = new SweepForm();
//3.监控界面窗体
public static Monitor monitor = new Monitor();
//4.驱动窗体
public static DriverForm driverForm = new DriverForm();
//5.硬件连接窗体
public static ConnectionForm connectionForm = new ConnectionForm();
/**
* 所有窗体共用变量
*/
//1.串口模式
public static String comMode = "";
//2.串口号
public static String comName = "";
//3.串口波特率
public static int comBodeRate = 9600;
//4. 串口对象(重要!!!所有子窗口都要用这个serialPort1成员变量!)
public static System.IO.Ports.SerialPort serialPort1 = null;
public MainMenu()
{
InitializeComponent();
}
/**
* 初始化函数,一些初始化控件的操作
*/
private void Form1_Load(object sender, EventArgs e)
{
// 1. 主窗体初始化
//this.WindowState = FormWindowState.Maximized; //最大化主窗体
// 主容器初始化
panel2.Width = this.Width;
panel2.Height = this.Height;
// 2. 子窗体初始化
//sweepForm.WindowState = FormWindowState.Maximized; //最大化窗体
sweepForm.StartPosition = FormStartPosition.CenterScreen;
//connectionForm.WindowState = FormWindowState.Maximized; //最大化窗体
connectionForm.StartPosition = FormStartPosition.CenterScreen;
//monitor.WindowState = FormWindowState.Maximized; //最大化窗体
monitor.StartPosition = FormStartPosition.CenterScreen;
//driverForm.WindowState = FormWindowState.Maximized; //最大化窗体
driverForm.StartPosition = FormStartPosition.CenterScreen;
statusStrip1.Items[0].Text = "版本号:0.0.0 ";
statusStrip1.Items[1].Text = "硬件状态:正常/异常 ";
statusStrip1.Items[2].Text = "当前操作: ";
}
private void button8_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
statusStripChange(button1);
buttonColorRefresh(button1);
// 切换界面
panel2.Controls.Clear();
panel2.Controls.Add(connectionForm);
connectionForm.Show();
}
private void button2_Click(object sender, EventArgs e)
{
statusStripChange(button2);
buttonColorRefresh(button2);
// 切换界面
panel2.Controls.Clear() ;
panel2.Controls.Add(sweepForm);
sweepForm.Show();
}
private void button5_Click(object sender, EventArgs e)
{
statusStripChange(button5);
buttonColorRefresh(button5);
// 切换界面
panel2.Controls.Clear();
panel2.Controls.Add(monitor);
monitor.Show();
}
private void button7_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
statusStripChange(button4);
buttonColorRefresh(button4);
panel2.Controls.Clear();
panel2.Controls.Add(driverForm);
driverForm.Show();
}
private void button3_Click(object sender, EventArgs e)
{
statusStripChange(button3);
buttonColorRefresh(button3);
}
/**
* 改变按下的按钮的颜色,突出显示
*/
private void buttonColorRefresh(Button button)
{
button1.BackColor = Color.DarkGray;
button2.BackColor = Color.DarkGray;
button3.BackColor = Color.DarkGray;
button4.BackColor = Color.DarkGray;
button5.BackColor = Color.DarkGray;
button6.BackColor = Color.DarkGray;
button.BackColor = Color.Black;
}
private void button6_Click(object sender, EventArgs e)
{
statusStripChange(button6);
buttonColorRefresh(button6);
}
public void statusStripChange(Button button)
{
statusStrip1.Items[2].Text = "当前操作:"+button.Text;
}
private void MainMenu_SizeChanged(object sender, EventArgs e)
{
/*welcomeForm.Width = this.Width;
welcomeForm.Height = this.Height-40;
sweepForm.Width = this.Width;
sweepForm.Height = this.Height - 40;*/
}
private void button3_Click_1(object sender, EventArgs e)
{
//button3.Text = Sum(1, 3).ToString();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。