2023-01-11 02:28:05 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Linq;
|
2023-01-12 02:46:28 +08:00
|
|
|
|
using System.Runtime.InteropServices;
|
2023-01-11 02:28:05 +08:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
2023-01-15 01:51:22 +08:00
|
|
|
|
namespace Tech_Demo
|
2023-01-11 02:28:05 +08:00
|
|
|
|
{
|
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
|
{
|
2023-01-31 00:39:15 +08:00
|
|
|
|
|
|
|
|
|
|
[DllImport("user32")]
|
|
|
|
|
|
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
|
|
|
|
|
|
|
|
|
|
|
|
public const Int32 AW_HOR_POSITIVE = 0x00000001; // 从左到右打开窗口
|
|
|
|
|
|
public const Int32 AW_HOR_NEGATIVE = 0x00000002; // 从右到左打开窗口
|
|
|
|
|
|
public const Int32 AW_VER_POSITIVE = 0x00000004; // 从上到下打开窗口
|
|
|
|
|
|
public const Int32 AW_VER_NEGATIVE = 0x00000008; // 从下到上打开窗口
|
|
|
|
|
|
public const Int32 AW_CENTER = 0x00000010; //若使用了AW_HIDE标志,则使窗口向内重叠;若未使用AW_HIDE标志,则使窗口向外扩展。
|
|
|
|
|
|
public const Int32 AW_HIDE = 0x00010000; //隐藏窗口,缺省则显示窗口。
|
|
|
|
|
|
public const Int32 AW_ACTIVATE = 0x00020000; //激活窗口。在使用了AW_HIDE标志后不要使用这个标志。
|
|
|
|
|
|
public const Int32 AW_SLIDE = 0x00040000; //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略。
|
|
|
|
|
|
public const Int32 AW_BLEND = 0x00080000; //使用淡出效果。只有当hWnd为顶层窗口的时候才可以使用此标志。
|
|
|
|
|
|
|
2023-01-11 02:28:05 +08:00
|
|
|
|
public Form1()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-01-17 17:36:07 +08:00
|
|
|
|
var playerView = new PlayerView();
|
|
|
|
|
|
playerView.Dock = DockStyle.Fill;
|
|
|
|
|
|
panelContainer.Controls.Add(playerView);
|
2023-01-31 00:39:15 +08:00
|
|
|
|
// AnimateWindow(playerView.Handle, 1000, AW_HOR_POSITIVE | AW_SLIDE);
|
2023-01-17 17:36:07 +08:00
|
|
|
|
// UCOverview uo = new UCOverview();
|
|
|
|
|
|
// uo.Dock = DockStyle.Fill;
|
|
|
|
|
|
// panelContainer.Controls.Add(uo);
|
2023-01-11 02:28:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-01-31 00:39:15 +08:00
|
|
|
|
// DialogResult dialogResult =
|
|
|
|
|
|
// MessageBox.Show(@"确定要退出吗?", @"确定退出?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
|
|
|
|
// if (dialogResult.Equals(DialogResult.OK))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// System.Environment.Exit(0);
|
|
|
|
|
|
// // Application.Exit();
|
|
|
|
|
|
// }
|
|
|
|
|
|
Boolean exist = false;
|
|
|
|
|
|
Panel settingView = null;
|
|
|
|
|
|
foreach (Control panelContainerControl in panelContainer.Controls)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine(panelContainerControl.Name);
|
|
|
|
|
|
// 存在设置
|
|
|
|
|
|
if(panelContainerControl.Name.Equals("settings"))
|
|
|
|
|
|
{
|
|
|
|
|
|
exist = true;
|
|
|
|
|
|
settingView = (Panel) panelContainerControl;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (exist == false)
|
2023-01-11 02:28:05 +08:00
|
|
|
|
{
|
2023-01-31 00:39:15 +08:00
|
|
|
|
var panel = new Panel();
|
|
|
|
|
|
panel.Size = new System.Drawing.Size(300, 670);
|
|
|
|
|
|
panel.BackColor = Color.White;
|
|
|
|
|
|
panel.Dock = DockStyle.Left;
|
|
|
|
|
|
panel.Name = "settings";
|
|
|
|
|
|
AnimateWindow(panel.Handle, 1000, AW_BLEND);
|
|
|
|
|
|
panelContainer.Controls.Add(panel);
|
2023-01-11 02:28:05 +08:00
|
|
|
|
}
|
2023-01-31 00:39:15 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 销毁
|
|
|
|
|
|
settingView.Dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-11 02:28:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var playerView = new PlayerView();
|
2023-01-13 07:42:12 +08:00
|
|
|
|
playerView.Dock = DockStyle.Fill;
|
|
|
|
|
|
foreach (Control container in this.panelContainer.Controls)
|
|
|
|
|
|
{
|
|
|
|
|
|
container.Dispose();
|
|
|
|
|
|
}
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
2023-01-11 02:28:05 +08:00
|
|
|
|
this.panelContainer.Controls.Clear();
|
|
|
|
|
|
this.panelContainer.Controls.Add(playerView);
|
|
|
|
|
|
}
|
2023-01-12 02:46:28 +08:00
|
|
|
|
|
|
|
|
|
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
// throw new System.NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox2_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2023-01-15 01:51:22 +08:00
|
|
|
|
DialogResult dialogResult =
|
|
|
|
|
|
MessageBox.Show(@"确定要退出吗?", @"确定退出?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
2023-01-12 02:46:28 +08:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
2023-01-12 02:46:28 +08:00
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
public static extern bool ReleaseCapture();
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
2023-01-12 02:46:28 +08:00
|
|
|
|
[DllImport("user32.dll")]
|
|
|
|
|
|
private static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
2023-01-12 02:46:28 +08:00
|
|
|
|
private const int WM_SYSCOMMAND = 0x0112;
|
|
|
|
|
|
private const int SC_MOVE = 0xF010;
|
|
|
|
|
|
private const int HTCAPTION = 0x0002;
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
2023-01-12 02:46:28 +08:00
|
|
|
|
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)
|
|
|
|
|
|
{
|
2023-01-15 01:51:22 +08:00
|
|
|
|
this.WindowState = this.WindowState == FormWindowState.Maximized
|
|
|
|
|
|
? FormWindowState.Normal
|
|
|
|
|
|
: FormWindowState.Maximized;
|
2023-01-13 07:42:12 +08:00
|
|
|
|
this.panelContainer.Refresh();
|
2023-01-12 02:46:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox4_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
|
|
|
|
|
|
}
|
2023-01-12 02:56:28 +08:00
|
|
|
|
|
|
|
|
|
|
private void closeBtn_MouseMove(object sender, MouseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
closeBtn.BackColor = Color.Crimson;
|
|
|
|
|
|
}
|
2023-01-15 01:51:22 +08:00
|
|
|
|
|
|
|
|
|
|
private void pictureBox3_MouseMove(object sender, MouseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox3.BackColor = Color.FromArgb(0, 98, 229);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox4_MouseMove(object sender, MouseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox4.BackColor = Color.FromArgb(0, 98, 229);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox3_MouseLeave(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox3.BackColor = Color.FromArgb(0, 110, 255);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox4_MouseLeave(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
pictureBox4.BackColor = Color.FromArgb(0, 110, 255);;
|
|
|
|
|
|
}
|
2023-01-17 17:36:07 +08:00
|
|
|
|
|
|
|
|
|
|
private void panelContainer_Paint(object sender, PaintEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
// throw new System.NotImplementedException();
|
|
|
|
|
|
}
|
2023-01-11 02:28:05 +08:00
|
|
|
|
}
|
2023-01-15 01:51:22 +08:00
|
|
|
|
}
|