FrmWaiting.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // ***********************************************************************
  2. // Assembly : HZH_Controls
  3. // Created : 08-08-2019
  4. //
  5. // ***********************************************************************
  6. // <copyright file="FrmWaiting.cs">
  7. // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
  8. // </copyright>
  9. //
  10. // Blog: https://www.cnblogs.com/bfyx
  11. // GitHub:https://github.com/kwwwvagaa/NetWinformControl
  12. // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
  13. //
  14. // If you use this code, please keep this note.
  15. // ***********************************************************************
  16. using System;
  17. using System.Collections.Generic;
  18. using System.ComponentModel;
  19. using System.Data;
  20. using System.Drawing;
  21. using System.Linq;
  22. using System.Text;
  23. using System.Windows.Forms;
  24. namespace HZH_Controls.Forms
  25. {
  26. /// <summary>
  27. /// Class FrmWaiting.
  28. /// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
  29. /// </summary>
  30. /// <seealso cref="HZH_Controls.Forms.FrmBase" />
  31. public partial class FrmWaiting : FrmBase
  32. {
  33. /// <summary>
  34. /// Gets or sets the MSG.
  35. /// </summary>
  36. /// <value>The MSG.</value>
  37. public string Msg { get { return label2.Text; } set { label2.Text = value; } }
  38. /// <summary>
  39. /// Initializes a new instance of the <see cref="FrmWaiting" /> class.
  40. /// </summary>
  41. public FrmWaiting()
  42. {
  43. base.SetStyle(ControlStyles.UserPaint, true);
  44. base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
  45. base.SetStyle(ControlStyles.DoubleBuffer, true);
  46. InitializeComponent();
  47. }
  48. /// <summary>
  49. /// Handles the Tick event of the timer1 control.
  50. /// </summary>
  51. /// <param name="sender">The source of the event.</param>
  52. /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
  53. private void timer1_Tick(object sender, EventArgs e)
  54. {
  55. if (this.label1.ImageIndex == this.imageList1.Images.Count - 1)
  56. this.label1.ImageIndex = 0;
  57. else
  58. this.label1.ImageIndex++;
  59. }
  60. /// <summary>
  61. /// Handles the VisibleChanged event of the FrmWaiting control.
  62. /// </summary>
  63. /// <param name="sender">The source of the event.</param>
  64. /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
  65. private void FrmWaiting_VisibleChanged(object sender, EventArgs e)
  66. {
  67. //this.timer1.Enabled = this.Visible;
  68. }
  69. /// <summary>
  70. /// Does the escape.
  71. /// </summary>
  72. protected override void DoEsc()
  73. {
  74. }
  75. /// <summary>
  76. /// Handles the Tick event of the timer2 control.
  77. /// </summary>
  78. /// <param name="sender">The source of the event.</param>
  79. /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
  80. private void timer2_Tick(object sender, EventArgs e)
  81. {
  82. base.Opacity = 1.0;
  83. this.timer2.Enabled = false;
  84. }
  85. /// <summary>
  86. /// Shows the form.
  87. /// </summary>
  88. /// <param name="intSleep">The int sleep.</param>
  89. public void ShowForm(int intSleep = 1)
  90. {
  91. base.Opacity = 0.0;
  92. if (intSleep <= 0)
  93. {
  94. intSleep = 1;
  95. }
  96. base.Show();
  97. this.timer2.Interval = intSleep;
  98. this.timer2.Enabled = true;
  99. }
  100. }
  101. }