52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraSplashScreen;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace DeviceRepairAndOptimization.Common
|
|
{
|
|
public static class FormExtended
|
|
{
|
|
public static void ShowInPanel(this PanelControl control, Pages.FormBase page)
|
|
{
|
|
control.Controls.Clear();
|
|
page.Dock = DockStyle.Fill;
|
|
page.TopLevel = false;
|
|
control.SizeChanged += page.page_Resize;
|
|
control.Controls.Add(page);
|
|
page.Show();
|
|
}
|
|
|
|
public static void ShowInPanel<T>(this PanelControl control) where T : Pages.FormBase
|
|
{
|
|
var type = typeof(T);
|
|
var page = Activator.CreateInstance(type) as Pages.FormBase;
|
|
control.Controls.Clear();
|
|
page.Dock = DockStyle.Fill;
|
|
page.TopLevel = false;
|
|
control.SizeChanged += page.page_Resize;
|
|
control.Controls.Add(page);
|
|
page.Show();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 关闭等待窗口
|
|
/// </summary>
|
|
/// <param name="ssm"></param>
|
|
public static void TryCloseWait(this SplashScreenManager ssm)
|
|
{
|
|
try
|
|
{
|
|
if (ssm.IsSplashFormVisible)
|
|
{
|
|
ssm.CloseWaitForm();
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
|
|
}
|
|
}
|