Demo-C/Tech/Form1.cs
2023-01-12 02:56:28 +08:00

109 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PlumByteUI_Learn
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
UCOverview uo = new UCOverview();
uo.Dock = DockStyle.Fill;
panelContainer.Controls.Add(uo);
}
private void button3_Click(object sender, EventArgs e)
{
throw new System.NotImplementedException();
}
private void button4_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show(@"确定要退出吗?", @"确定退出?", MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if (dialogResult.Equals(DialogResult.OK))
{
System.Environment.Exit(0);
// Application.Exit();
}
}
private void button1_Click(object sender, EventArgs e)
{
var playerView = new PlayerView();
this.panelContainer.Controls.Clear();
this.panelContainer.Controls.Add(playerView);
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
// throw new System.NotImplementedException();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show(@"确定要退出吗?", @"确定退出?", MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if (dialogResult.Equals(DialogResult.OK))
{
System.Environment.Exit(0);
// Application.Exit();
}
}
private void pictureBox2_MouseHover(object sender, EventArgs e)
{
}
private void closeBtn_MouseHover(object sender, EventArgs e)
{
closeBtn.BackColor = Color.Crimson;
}
private void closeBtn_MouseLeave(object sender, EventArgs e)
{
closeBtn.BackColor = Color.FromArgb(0, 110, 255);
}
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
private static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_MOVE = 0xF010;
private const int HTCAPTION = 0x0002;
private void TopPanel_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
private void pictureBox3_Click(object sender, EventArgs e)
{
this.WindowState = this.WindowState == FormWindowState.Maximized ? FormWindowState.Normal : FormWindowState.Maximized;
}
private void pictureBox4_Click(object sender, EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
}
private void closeBtn_MouseMove(object sender, MouseEventArgs e)
{
closeBtn.BackColor = Color.Crimson;
}
}
}