WPF简单实用方法(持续更新)

2023-09-11,,

1:点击退出提示框

 MessageBoxResult result = MessageBox.Show("你真的要退出吗?", "", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
this.Close();
}

2:移动窗体

 private void Border_MouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}

3.最小化/最大化

 private void Min_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.WindowState = WindowState.Minimized;
//this.WindowState = WindowState.Maximized;//最大化
}

4.窗体最大宽度、最大高度/窗体最小宽度、最小高度

 public Evaluation()
{
this.MaxWidth = ;
this.MaxHeight = ;
this.MinWidth = ;
this.MinHeight = ;
InitializeComponent();
}

WPF简单实用方法(持续更新)的相关教程结束。

《WPF简单实用方法(持续更新).doc》

下载本文的Word格式文档,以方便收藏与打印。