-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormCastControl.cs
55 lines (46 loc) · 1.71 KB
/
FormCastControl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Windows.Forms;
using static ITClassHelper.Window;
namespace ITClassHelper
{
public partial class FormCastControl : Form
{
public FormCastControl() => InitializeComponent();
private void HideCastButton_Click(object sender, EventArgs e)
{
HideCast();
Hide();
}
private void ShowCastButton_Click(object sender, EventArgs e) => ShowCast();
private void HideControllerButton_Click(object sender, EventArgs e) => Hide();
private void ShowCast()
{
IntPtr castWindow = GetCastWindow();
SetWindowPos(castWindow, WndPos.NoTopMost, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, (uint)SWP.SWP_SHOWWINDOW);
Hide();
}
private void HideCast()
{
IntPtr castWindow = GetCastWindow();
SetWindowPos(castWindow, WndPos.NoTopMost, Size.Width, Size.Height, 0, 0, (uint)SWP.SWP_SHOWWINDOW);
}
private void MinimizeCastButton_Click(object sender, EventArgs e) => Hide();
private void SetCastTitleBarButton_Click(object sender, EventArgs e)
{
IntPtr castWindow = GetCastWindow();
if (castWindow != IntPtr.Zero)
{
if (SetCastTitleBarButton.Text == "显示\n标题栏")
{
ShowWindowTitleBar(castWindow);
SetCastTitleBarButton.Text = "隐藏\n标题栏";
}
else
{
HideWindowTitleBar(castWindow);
SetCastTitleBarButton.Text = "显示\n标题栏";
}
}
}
}
}