WPF 无标题栏窗口鼠标拖动改变大小

原理:
 [DllImport("user32.dll", CharSet = CharSet.Auto)]
 private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
SendMessage(_HwndSource.Handle, WM_SYSCOMMAND, (IntPtr)(61440 + direction), IntPtr.Zero);

其中,

private const int WM_SYSCOMMAND = 0x112;

第三个参数是附加的,这个是标记拖动的方向 

private enum ResizeDirection
        {
            Left = 1,
            Right = 2,
            Top = 3,
            TopLeft = 4,
            TopRight = 5,
            Bottom = 6,
            BottomLeft = 7,
            BottomRight = 8,
        }


你可能感兴趣的:(VC,C#,WPF)