public bool PreFilterMessage(
ref System.Windows.Forms.Message m)
{
try
{
if (
this.unityPlayer ==
null)
{
return false;
}
if (m.Msg == WMConst.WM_KEYUP || m.Msg == WMConst.WM_SYSKEYUP)
{
int param = m.WParam.ToInt32();
if (param == (
int)Keys.F11)
{
Interop_KeyUp_F11();
return true;
}
}
System.Drawing.Rectangle area =
new System.Drawing.Rectangle(
this.unityPlayer.Location,
this.unityPlayer.Size);
Point pos = Control.MousePosition;
if (area.Contains(
this.PointToClient(pos)))
{
switch (m.Msg)
{
case WMConst.WM_RBUTTONDOWN:
if (
this.ContextMenuStrip !=
null)
{
pos =
this.unityPlayer.PointToClient(pos);
this.m_contextMenuStrip.Show(
this.unityPlayer,
new Point(pos.X, pos.Y));
}
return true;
case WMConst.WM_RBUTTONUP:
return true;
case WMConst.WM_RBUTTONDBLCLK:
return true;
default:
return false;
}
}
return false;
}
catch (Exception ex)
{
return false;
}
}
public void Interop_KeyUp_F11()
{
try
{
this.m_fullScreen = !
this.m_fullScreen;
if (
this.m_fullScreen)
{
this.Dock = DockStyle.None;
this.Left =
0;
this.Top =
0;
this.Width = Screen.PrimaryScreen.Bounds.Width;
this.Height = Screen.PrimaryScreen.Bounds.Height;
Methods.SetParent(
this.Handle, IntPtr.Zero);
base.Parent.Hide();
}
else
{
Methods.SetParent(
this.Handle,
base.Parent.Handle);
base.Parent.Show();
}
}
catch (Exception ex)
{
}
}
转载请注明原文地址: https://ju.6miu.com/read-300150.html