自定义控件代码:
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 WindowsFormsApp软键盘应用
{
public partial class SoftKey : UserControl
{
public SoftKey()
{
InitializeComponent();
}
//属性
private string str = "";
public string Str
{
get { return str; }
set { str = value; Invalidate(); }
}
void btn_A_Click(object sender, EventArgs e)
{
textBox1.Text += "-";
textBox1.SelectionStart = textBox1.Text.Length;
}
vo