Delete unused methods from MessageBoxEx.
This commit is contained in:
@@ -1,14 +1,9 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Drawing;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace CsvView.UI
|
namespace CsvView.UI
|
||||||
{
|
{
|
||||||
public static class MessageBoxEx
|
public static class MessageBoxEx
|
||||||
{
|
{
|
||||||
private static IWin32Window _owner;
|
|
||||||
|
|
||||||
public static DialogResult Show(string text)
|
public static DialogResult Show(string text)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
@@ -47,83 +42,45 @@ namespace CsvView.UI
|
|||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text)
|
public static DialogResult Show(IWin32Window owner, string text)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text);
|
return MessageBox.Show(owner, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text, string caption)
|
public static DialogResult Show(IWin32Window owner, string text, string caption)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text, caption);
|
return MessageBox.Show(owner, text, caption);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
|
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text, caption, buttons);
|
return MessageBox.Show(owner, text, caption, buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text, caption, buttons, icon);
|
return MessageBox.Show(owner, text, caption, buttons, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton)
|
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text, caption, buttons, icon, defButton);
|
return MessageBox.Show(owner, text, caption, buttons, icon, defButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
|
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options)
|
||||||
{
|
{
|
||||||
_owner = owner;
|
|
||||||
Initialize();
|
Initialize();
|
||||||
return MessageBox.Show(owner, text, caption, buttons, icon,
|
return MessageBox.Show(owner, text, caption, buttons, icon,
|
||||||
defButton, options);
|
defButton, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle lpRect);
|
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern int MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
|
||||||
|
|
||||||
private static void Initialize()
|
private static void Initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CenterWindow(IntPtr hChildWnd)
|
|
||||||
{
|
|
||||||
Rectangle recChild = new Rectangle(0, 0, 0, 0);
|
|
||||||
GetWindowRect(hChildWnd, ref recChild);
|
|
||||||
|
|
||||||
int width = recChild.Width - recChild.X;
|
|
||||||
int height = recChild.Height - recChild.Y;
|
|
||||||
|
|
||||||
Rectangle recParent = new Rectangle(0, 0, 0, 0);
|
|
||||||
GetWindowRect(_owner.Handle, ref recParent);
|
|
||||||
|
|
||||||
Point ptCenter = new Point(0, 0);
|
|
||||||
ptCenter.X = recParent.X + ((recParent.Width - recParent.X) / 2);
|
|
||||||
ptCenter.Y = recParent.Y + ((recParent.Height - recParent.Y) / 2);
|
|
||||||
|
|
||||||
|
|
||||||
Point ptStart = new Point(0, 0);
|
|
||||||
ptStart.X = (ptCenter.X - (width / 2));
|
|
||||||
ptStart.Y = (ptCenter.Y - (height / 2));
|
|
||||||
|
|
||||||
ptStart.X = (ptStart.X < 0) ? 0 : ptStart.X;
|
|
||||||
ptStart.Y = (ptStart.Y < 0) ? 0 : ptStart.Y;
|
|
||||||
|
|
||||||
MoveWindow(hChildWnd, ptStart.X, ptStart.Y, width, height, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user