📄 popupwindow.cs
字号:
namespace Imps.Client.Pc.Controls
{
using Imps.Client.Pc;
using Imps.Client.Utils.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public abstract class PopupWindow : Form
{
protected IContainer components;
public PopupWindow()
{
this.InitializeComponent();
base.Disposed += new EventHandler(this.PopupWindow_Disposed);
BossKey.HiddenEvent += new EventHandler(this.BossKey_HiddenEvent);
}
private void BossKey_HiddenEvent(object sender, EventArgs e)
{
this.HandleBossKey();
}
protected void DisplayWithActive(int x, int y)
{
this.ShowWindow(true);
Imps.Client.Utils.Win32.NativeMethods.SetWindowPos(base.Handle, -1, x, y, base.Width, base.Height, 0x10);
}
protected void DisplayWithoutActive(int x, int y)
{
this.ShowWindow(false);
Imps.Client.Utils.Win32.NativeMethods.SetWindowPos(base.Handle, -1, x, y, base.Width, base.Height, 0x10);
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
protected virtual void HandleBossKey()
{
BossKey.HandleBossKeyEvent(this);
}
protected virtual void InitializeComponent()
{
base.SuspendLayout();
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.set_AutoScaleMode(1);
this.BackColor = Color.White;
base.CausesValidation = false;
base.ClientSize = new Size(0x124, 0x10a);
base.ControlBox = false;
this.set_DoubleBuffered(true);
base.FormBorderStyle = FormBorderStyle.None;
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "PopupWindow";
base.ShowInTaskbar = false;
base.StartPosition = FormStartPosition.Manual;
this.Text = "PopupWindow";
base.ResumeLayout(false);
}
protected void MoveWindow(int left, int top, int width, int height)
{
Imps.Client.Utils.Win32.NativeMethods.MoveWindow(base.Handle, left, top, width, height, true);
}
private void PopupWindow_Disposed(object sender, EventArgs e)
{
BossKey.HiddenEvent -= new EventHandler(this.BossKey_HiddenEvent);
}
protected void ShowWindow(bool active)
{
if (!BossKey.Hidden)
{
if (active)
{
Imps.Client.Utils.Win32.NativeMethods.ShowWindow(base.Handle, 5);
}
else
{
Imps.Client.Utils.Win32.NativeMethods.ShowWindow(base.Handle, 4);
}
}
}
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
System.Windows.Forms.CreateParams createParams = base.CreateParams;
createParams.ExStyle |= 0x80;
return createParams;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -