WPF 中怎样禁用最大化按钮,保留最小化和关闭按钮,但是窗口大小还可以改变?ResizeMode
发布网友
发布时间:2022-05-15 11:40
我来回答
共1个回答
热心网友
时间:2023-10-22 09:56
下面代码测试成功:
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