public BaseForm() { this.dragSize = builder.DragSize; this._skinmobile = builder.SkinMobile; this.isShadow = builder.IsShadow; this.Font = builder.Font; this.ForeColor = builder.ForeColor; this.titleBackColor = builder.TitleBackColor; this.titleCenter = builder.TitleCenter; this.titleVisible = builder.TitleVisible; this.logoVisible = builder.LogoVisible; this.maximazeBox = builder.MaximizeBox; this.minimazeBox = builder.MinimizeBox; this.maxBoxImage = builder.MaxBoxImage; this.restoreBoxImage = builder.RestoreBoxImage; this.maxBoxImage = builder.MinBoxImage; this.closeBoxImage = builder.CloseBoxImage; this.maxBoxBackColor = builder.MaxBoxBackColor; this.minBoxBackColor = builder.MinBoxBackColor; this.closeBoxBackColor = builder.CloseBoxBackColor; this.maxBoxFontColor = builder.MaxBoxFontColor; this.minBoxFontColor = builder.MinBoxFontColor; this.closeBoxFontColor = builder.CloseBoxFontColor; this.BackColor = builder.FormBackColor; this.titleForeColor = builder.TitleForeColor; this.titleHeight = builder.TitleHeight; this.titleButtonWidth = builder.TitleButtonWidth; Application.AddMessageFilter(new MouseMessageFilter()); MouseMessageFilter.MouseMove += OnGlobalMouseMove; base.FormBorderStyle = FormBorderStyle.None; //减少闪烁 SetStyles(); Title = new Rectangle(0, 0, this.Width, titleHeight); _xButtonBounds = new Rectangle(this.Width - titleButtonWidth, 0, titleButtonWidth, titleHeight); _maxButtonBounds = new Rectangle(_xButtonBounds.X - titleButtonWidth, 0, titleButtonWidth, titleHeight); _minButtonBounds = new Rectangle(_maxButtonBounds.X - titleButtonWidth, 0, titleButtonWidth, titleHeight); //窗体关闭时 Closing += (sender, e) => { //先关闭阴影窗体 if (skin != null) { skin.Close(); } }; }
//窗体关闭时 protected override void OnClosing(CancelEventArgs e) { if (animation != null && animation.IsClose == false) { animation.OnClosing(); e.Cancel = true; } base.OnClosing(e); //先关闭阴影窗体 if (skin != null) { skin.Close(); } }