RyLiveTools/Source/Content/CustomWindow.cs

34 lines
1010 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Interop;
using System.Windows;
namespace LiveTools
{
public class CustomWindow : Window
{
public CustomWindow()
{
WindowStyle = WindowStyle.None;
}
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
WindowInteropHelper helper = new WindowInteropHelper(this);
SetWindowLong(helper.Handle, GWL_STYLE, GetWindowLong(helper.Handle, GWL_STYLE) & ~WS_SYSMENU);
}
internal const int GWL_STYLE = -16;
internal const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll")]
internal static extern int GetWindowLong(IntPtr hwnd, int index);
[DllImport("user32.dll")]
internal static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
}
}