using MGdu.WinFormUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace RySkins
{
public partial class SkinMdiForm : GMForm
{
///
/// 顶部栏
///
[Description("顶部栏")]
public Panel TopPanel { get; set; } = null;
public SkinMdiForm()
{
InitializeComponent();
InitMdiSkin();
}
#region 加载皮肤
///
/// 加载皮肤
///
private void InitMdiSkin()
{
_mdiClient = FindMdiClient();
base.SizeChanged += new EventHandler((object sender, EventArgs e) =>
{
if (base.WindowState == FormWindowState.Maximized)
{
base.ControlBoxOffset = new Point(4, base.BorderWidth);
}
else
{
base.ControlBoxOffset = new Point(4, 1);
}
SetFormItemLocation(TopPanel);
});
base.Load += new EventHandler((object sender, EventArgs e) =>
{
base.XTheme = new ThemeForm();
base.XTheme.Mdi_TabMinWidth = 70;
base.XTheme.Mdi_TabNormalWidth = 100;
base.XTheme.Mdi_TabMaxWidth = 145;
base.XTheme.Mdi_ShowNewTabBtn = false;
base.XTheme.Mdi_AlwaysShowListAllBtn = false;
base.XTheme.Mdi_BarBottomRegionHeight = 0;
base.XTheme.Mdi_ShowTabCloseIcon = false;
base.XTheme.Mdi_TabShowBorder = false;
base.XTheme.Mdi_BarMargin = new Padding(6, 0, 100, 0);
base.XTheme.Mdi_TabActiveBackColorTop = Color.White;
base.XTheme.Mdi_TabActiveBackColorBottom = Color.FromArgb(248, 248, 248);
base.XTheme.Mdi_TabDeactiveBackColorTop = Color.FromArgb(230, 230, 230);
base.XTheme.Mdi_TabDeactiveBackColorBottom = Color.FromArgb(230, 230, 230);
//base.XTheme.Mdi_UseMsgToActivateChild
base.MdiNewTabButtonClick += new EventHandler(NewFormClick);
base.MdiTabCloseButtonClick += new EventHandler(ChildFormClose);
//base.XTheme.Mdi_TabTopSpace += 80;
if (_mdiClient != null)
{
_mdiClient.Dock = DockStyle.None;
_mdiClient.BackColor = Color.White;
}
});
base.MdiBarCreated += new EventHandler((object sender, EventArgs e) =>
{
SetFormItemLocation(TopPanel);
Application.DoEvents();
Thread th = new Thread(Start);
th.Start();
void Start()
{
Thread.Sleep(10);
this.Invoke(new Action(() =>
{
this.SuspendLayout();
for (int i = 0; i < MdiForms.Count; i++)
{
CreateNewChild(MdiForms[i]);
}
this.ResumeLayout(false);
//CreateNewChild(typeof(DbOp.FrmCaijiView));
//Application.DoEvents();
if (this.MdiChildren.Length > 0)
{
this.ActivateMdiChildForm(this.MdiChildren[0]);
}
}));
}
});
}
///
/// 要初始化加载的Form列表
///
public List