| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace MeterModuleLibrary
- {
- public partial class ucCarNoKey : UserControl
- {
- public ucCarNoKey()
- {
- InitializeComponent();
- }
- public string strValue = "";
- private void btnSetValue_Click(object sender, EventArgs e)
- {
- Button btn = (Button)sender;
- int i = txtValue.SelectionStart;
- txtValue.Focus();
- txtValue.Text = txtValue.Text.Trim() + btn.Text;
- txtValue.Select(++i, 0);
- }
- private void btnProvince_Click(object sender, EventArgs e)
- {
- Button btn = (Button)sender;
- txtProvince.Text = btn.Text;
- }
- private void btnLeft_Click(object sender, EventArgs e)
- {
- int i = txtValue.SelectionStart;
- txtValue.Focus();
- if (i > 0)
- txtValue.Select(--i, 0);
- }
- private void btnRight_Click(object sender, EventArgs e)
- {
- int i = txtValue.SelectionStart;
- txtValue.Focus();
- if (i < txtValue.Text.Trim().Length)
- txtValue.Select(++i, 0);
- }
- private void btnBack_Click(object sender, EventArgs e)
- {
- int i = txtValue.SelectionStart;
- txtValue.Focus();
- if (i > 0)
- {
- txtValue.Text = txtValue.Text.Trim().Substring(0, i - 1) + txtValue.Text.Trim().Substring(i);
- txtValue.Select(--i, 0);
- }
- }
- private void btnClean_Click(object sender, EventArgs e)
- {
- txtValue.Text = "";
- }
- private void btnSubmit_Click(object sender, EventArgs e)
- {
- strValue = txtValue.Text.Trim();
- txtValue.Text = "";
- //此处还需调用加载该用户控件的界面关闭方法
- }
- }
- }
|