2025-03-31 13:39:28 +08:00

72 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.db;
using WindowsFormsApp1.mod;
namespace WindowsFormsApp1
{
public partial class LoadingForm : Form
{
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// LoadingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(300, 100);
this.Name = "LoadingForm";
this.Text = "LoadingForm";
this.ResumeLayout(false);
}
public LoadingForm(string message = "正在处理中...")
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.None;
this.Size = new Size(300, 100);
this.BackColor = Color.White;
this.TopMost = true; // 设置窗体始终显示在最顶层
this.ShowInTaskbar = false; // 不在任务栏显示
Label loadingLabel = new Label();
loadingLabel.Text = message;
loadingLabel.AutoSize = false;
loadingLabel.Size = new Size(280, 30);
loadingLabel.TextAlign = ContentAlignment.MiddleCenter;
loadingLabel.Location = new Point((this.Width - loadingLabel.Width) / 2,
(this.Height - loadingLabel.Height) / 2);
this.Controls.Add(loadingLabel);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ClassStyle |= 0x20000; // CS_DROPSHADOW
return cp;
}
}
}
}