我有一个用户控件,它包含一个面板,该面板包含一个图片框。当我将鼠标移动到图片框上时,我想更新 MainForm 上的标签。我在主窗体上有一个 get/set 方法,但我该如何使用它?谢谢
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
public String MouseCords
{
get { return this.MouseCordsDisplayLabel.Text; }
set { this.MouseCordsDisplayLabel.Text = value; }
}
}
public partial class ScoreUserControl : UserControl
{
public ScoreUserControl()
{
InitializeComponent();
}
private void ScorePictureBox_MouseMove(object sender, MouseEventArgs e)
{
// MainForm.MouseCords("Hello"); //What goes here?
}
}