/// <summary> /// 将窗体显示为具有指定所有者的模式对话框。 /// </summary> /// <param name="owner">任何实现 <see cref="T:System.Windows.Forms.IWin32Window" />(表示将拥有模式对话框的顶级窗口)的对象。</param> /// <returns><see cref="T:System.Windows.Forms.DialogResult" /> 值之一。</returns> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" /> /// <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// </PermissionSet> public new DialogResult ShowDialog(IWin32Window owner) { try { if (this._isShowMaskDialog && owner != null) { var frmOwner = (Control)owner; FrmTransparent _frmTransparent = new FrmTransparent(); _frmTransparent.Width = frmOwner.Width; _frmTransparent.Height = frmOwner.Height; Point location = frmOwner.PointToScreen(new Point(0, 0)); _frmTransparent.Location = location; _frmTransparent.frmchild = this; _frmTransparent.IsShowMaskDialog = false; return(_frmTransparent.ShowDialog(owner)); } else { return(base.ShowDialog(owner)); } } catch (NullReferenceException) { return(System.Windows.Forms.DialogResult.None); } }
protected override void WndProc(ref Message m) { if (m.Msg == 33) { m.Result = new IntPtr(3); } else { if (m.Msg == 134) { if (((int)m.WParam & 65535) != 0) { if (m.LParam != IntPtr.Zero) { FrmTransparent.SetActiveWindow(m.LParam); } else { FrmTransparent.SetActiveWindow(IntPtr.Zero); } } } else if (m.Msg == 2000) { } base.WndProc(ref m); } }