Form1.cs 997 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsStatusStrip
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void Form1_Load(object sender, EventArgs e)
  19. {
  20. this.toolStripStatusLabel2.Text = DateTime.Now.ToShortDateString();//将系统当前时间赋值给一个Label控件,也就是toolStripStatusLabel2
  21. }
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. this.toolStripProgressBar1.Minimum = 0;
  25. this.toolStripProgressBar1.Maximum = 5000;
  26. this.toolStripProgressBar1.Step = 2;
  27. for (int i = 0; i <= 4999; i++)
  28. {
  29. this.toolStripProgressBar1.PerformStep();
  30. }
  31. }
  32. }
  33. }