42 lines
935 B
C#
42 lines
935 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CanFly.Util
|
|
{
|
|
public static class FormUtils
|
|
{
|
|
|
|
/// <summary>
|
|
/// 显示窗体
|
|
/// </summary>
|
|
/// <param name="panel"></param>
|
|
/// <param name="frm"></param>
|
|
public static void ShowForm(this Panel panel, Form frm)
|
|
{
|
|
|
|
try
|
|
{
|
|
frm.TopLevel = false;
|
|
panel.Controls.Clear();
|
|
panel.Controls.Add(frm);
|
|
frm.Show();
|
|
frm.Dock = DockStyle.Fill;
|
|
panel.Refresh();
|
|
foreach (Control item in frm.Controls)
|
|
{
|
|
item.Focus();
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|