Window属性设置
<Window x:Class="MainInterface.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStyle="None"
Background="{x:Null}"
AllowsTransparency="True"
Title="iHealth"
Height="594"
MinHeight="400"
Width="288"
MaxWidth="500">
<Grid>
<Border Background="Orange"/>
</Grid>
</Window>
借助 HwndSource 添加 Hook,截取 Windows 消息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Interop;
namespace MainInterface
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
#region 无边框窗体移动和大小调整
private const int WM_NCHITTEST = 0x0084;
private readonly int agWidth = 12; //拐角宽度
private readonly int bThick