Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个继承 TextBox 的用户控件。但不知何故,点击事件不起作用。其他事件有效。如何使该工作单击?
this.Click += new EventHandler(AfyTransparentTextBox_Click); private void AfyTransparentTextBox_Click(object sender, EventArgs e) { MessageBox.Show("KY-KY"); }
我不知道这是否适合您的场景,但它有效:
public class AfyTransparentTextBox : TextBox { protected override void OnClick(EventArgs e) { System.Windows.MessageBox.Show("KY-KY"); base.OnClick(e); } }