Loading.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Drawing;
  3. using System.Threading.Tasks;
  4. using System.Windows.Forms;
  5. namespace UppPay.Forms
  6. {
  7. public partial class Loading : Form
  8. {
  9. public Loading()
  10. {
  11. InitializeComponent();
  12. // 设置窗体属性
  13. this.FormBorderStyle = FormBorderStyle.FixedDialog;
  14. this.MaximizeBox = false;
  15. this.MinimizeBox = false;
  16. this.StartPosition = FormStartPosition.CenterScreen;
  17. this.ShowInTaskbar = false;
  18. this.TopMost = true;
  19. // 初始化控件
  20. label1.Text = "加载中...";
  21. label1.ForeColor = Color.Black; // 文字颜色
  22. label1.BackColor = Color.Transparent; // 透明背景
  23. label1.BorderStyle = BorderStyle.None; // 无边框
  24. label1.AutoSize = true; // 自动适应文字大小(或手动设置Size)
  25. }
  26. public void lblStatusText(String Text)
  27. {
  28. label1.Text = Text;
  29. label1.ForeColor = Color.Red;
  30. }
  31. public void label2Text(int Time,int warningTime)
  32. {
  33. label2.Text = Time.ToString();
  34. // 时间不足时改变颜色
  35. if (Time <= warningTime)
  36. {
  37. label2.ForeColor = Color.Red;
  38. }
  39. }
  40. public void CloseLoading()
  41. {
  42. this.DialogResult = DialogResult.OK;
  43. this.Close();
  44. }
  45. }
  46. }