wpf - 最大化 WPF 不会更新宽度?
public partial class BigPicture : Window { private readonly Image _img; public BigPicture(Image img) { _img = img; InitializeComponent(); WindowState = WindowState.Maximized; RefreshPic(); } private void Grid_SizeChanged(object sender, SizeChangedEventArgs e) { RefreshPic(); } private void RefreshPic() { ImgBigPic.Width = Math.Max(Width, ActualWidth) - 50; ImgBigPic.Height = Math.Max(Height, ActualHeight) - 50; ImgBigPic.Stretch = Stretch.Uniform; ImgBigPic.Source = _img.Source; } }
https://www.coder.work/article/6789618
浙公网安备 33010602011771号