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.
当 WPF 窗口打开时,它必须准备好处理鼠标单击事件。它必须处理此事件,直到窗口关闭。
您可以在窗口中创建具有共享行为的单个函数,然后从加载的处理程序和按钮单击处理程序中调用该函数。
喜欢-
void MainWindow_Loaded(object sender, RoutedEventArgs e) { button1_Click(sender, new RoutedEventArgs()); }