• 大小: 0.06M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-06-16
  • 语言: C#
  • 标签: 数字  C#  键盘  

资源简介

C#数字键盘

资源截图

代码片段和文件信息

using System;
using System.Windows.Forms;

namespace App
{
    public partial class DigitalKeyboardForm : Form
    {
        /// 
        /// 输入数据最大值
        /// 

        public int ExMaxValue { set; get; } = 1000;

        /// 
        /// 输入数据最小值
        /// 

        public int ExMinValue { set; get; } = 0;

        /// 
        /// 当前值
        /// 

        public int ExNowValue { set; get; } = 0;

        /// 
        /// 返回值
        /// 

        public bool ExResault { get; private set; } = false;

        public DigitalKeyboardForm()
        {
            InitializeComponent();
        }

        private void DigitalKeyboardForm_Load(object sender EventArgs e)
        {
            this.KeyPreview = true;
            this.KeyDown += form_KeyDown;

            //显示当前值
            textBoxValue.Text = ExNowValue.ToString();
            labelMaxMin.Text = string.Format(“最小值: {0}   最大值: {1}“ ExMinValue ExMaxValue);
        }

        private void form_KeyDown(object sender KeyEventArgs e)
        {
            if (e.KeyData == Keys.Escape)
            {
                ExResault = false;
                this.Close();
            }
        }

        private void button1_Click(object sender EventArgs e)
        {
            SetNumber(1);
        }

        private void button2_Click(object sender EventArgs e)
        {
            SetNumber(2);
        }

        private void button3_Click(object sender EventArgs e)
        {
            SetNumber(3);
        }

        private void button4_Click(object sender EventArgs e)
        {
            SetNumber(4);
        }

        private void button5_Click(object sender EventArgs e)
        {
            SetNumber(5);
        }

        private void button6_Click(object sender EventArgs e)
        {
            SetNumber(6);
        }

        private void button7_Click(object sender EventArgs e)
        {
            SetNumber(7);
        }

        private void button8_Click(object sender EventArgs e)
        {
            SetNumber(8);
        }

        private void button9_Click(object sender EventArgs e)
        {
            SetNumber(9);
        }

        private void button0_Click(object sender EventArgs e)
        {
            SetNumber(0);
        }

        private void buttonBack_Click(object sender EventArgs e)
        {
            if (ExNowValue == 0)
            {
                ExNowValue = 0;
            }
            else
            {
                ExNowValue = ExNowValue / 10;
            }
            textBoxValue.Text = ExNowValue.ToString();
        }

        private void buttonOK_Click(object sender EventArgs e)
        {
            if (ExNowValue < ExMinValue)
            {
                MessageBox.Show(string.Format(“输入值不能小于{0}“ ExMinValue));
            

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1107  2021-12-28 18:02  App\App.sln
     目录           0  2021-12-28 18:02  App\App\
     文件        3753  2021-12-28 18:02  App\App\App.csproj
     目录           0  2021-12-28 18:02  App\App\bin\
     目录           0  2021-12-28 18:02  App\App\bin\Debug\
     文件       16384  2021-12-28 18:02  App\App\bin\Debug\App.exe
     文件       42496  2021-12-28 18:02  App\App\bin\Debug\App_20190727_201941.pdb
     目录           0  2021-12-28 18:02  App\App\bin\Release\
     文件        3770  2021-12-28 18:02  App\App\DigitalKeyboardForm.cs
     文件       15491  2021-12-28 18:02  App\App\DigitalKeyboardForm.designer.cs
     文件        5817  2021-12-28 18:02  App\App\DigitalKeyboardForm.resx
     目录           0  2021-12-28 18:02  App\App\obj\
     目录           0  2021-12-28 18:02  App\App\obj\Debug\
     文件          42  2021-12-28 18:02  App\App\obj\Debug\App.csproj.CoreCompileInputs.cache
     文件         887  2021-12-28 18:02  App\App\obj\Debug\App.csproj.FileListAbsolute.txt
     文件         922  2021-12-28 18:02  App\App\obj\Debug\App.csproj.GenerateResource.cache
     文件        9084  2021-12-28 18:02  App\App\obj\Debug\App.csprojAssemblyReference.cache
     文件         180  2021-12-28 18:02  App\App\obj\Debug\App.DigitalKeyboardForm.resources
     文件       16384  2021-12-28 18:02  App\App\obj\Debug\App.exe
     文件       42496  2021-12-28 18:02  App\App\obj\Debug\App.pdb
     文件         180  2021-12-28 18:02  App\App\obj\Debug\App.Properties.Resources.resources
     文件         180  2021-12-28 18:02  App\App\obj\Debug\App.TestForm.resources
     文件         753  2021-12-28 18:02  App\App\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6900  2021-12-28 18:02  App\App\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2021-12-28 18:02  App\App\obj\Debug\TempPE\
     文件         487  2021-12-28 18:02  App\App\Program.cs
     目录           0  2021-12-28 18:02  App\App\Properties\
     文件        1304  2021-12-28 18:02  App\App\Properties\AssemblyInfo.cs
     文件        2819  2021-12-28 18:02  App\App\Properties\Resources.Designer.cs
     文件        5612  2021-12-28 18:02  App\App\Properties\Resources.resx
     文件        1090  2021-12-28 18:02  App\App\Properties\Settings.Designer.cs
............此处省略5个文件信息

评论

共有 条评论