WPF 中怎样禁用最大化按钮,保留最小化和关闭按钮,但是窗口大小还可以改变?ResizeMode
WPF中怎样禁用最大化按钮,保留最小化和关闭按钮,但是窗口大小还可以改变?ResizeMode试过了,但是窗体无法改变大小了,所以有无别的办法?我用的是vb.net...
WPF 中怎样禁用最大化按钮,保留最小化和关闭按钮,但是窗口大小还可以改变?ResizeMode 试过了,但是窗体无法改变大小了,所以有无别的办法?我用的是vb.net
展开
1个回答
展开全部
下面代码测试成功:
Imports System.Windows.Interop
Class MainWindow
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
Dim s = HwndSource.FromHwnd(New WindowInteropHelper(Me).Handle)
s.AddHook(New HwndSourceHook(AddressOf WndProc))
End Sub
Shared Function WndProc(ByVal h As IntPtr, ByVal m As Integer, ByVal w As IntPtr, ByVal l As IntPtr, ByRef c As Boolean) As IntPtr
If m = &H112 Then
If w.ToInt32 = &HF030 Then
c = True
End If
End If
End Function
End Class
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询