Form1.cs 732 B

12345678910111213141516171819202122232425262728293031
  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 WindowsFormsNumericUpDown
  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. numericUpDown1.Maximum = 20;
  21. numericUpDown1.Minimum = 1;
  22. }
  23. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  24. {
  25. label1.Text = "当前控件中显示的数值:" + numericUpDown1.Value;
  26. }
  27. }
  28. }