如果要作成透明的话,窗体本身很难获得Mouse事件,直接点到后面的东西去了,我做了个例子
Window.xmal代码:
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Right Click To Close" Height="300" Width="300"
WindowStyle="None" AllowsTransparency="True" MouseRightButtonUp="WindowClicked"
Background="{x:Null}"
>
MouseLeftButtonDown="DragWindow" FontFamily="Impact" Foreground="Red"/>
Window.xmal.cs 代码:
using System;
using System.Collections.Generic;
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.Shapes;
namespace Test
{
public partial class Class1 : System.Windows.Window
{
public Class1()
{
InitializeComponent();
}
public void DragWindow(object sender, MouseButtonEventArgs args)
{
DragMove();
}
public void WindowClicked(object sender, MouseButtonEventArgs args)
{
Close();
}
}
}
form的试过,wpf的还没玩过
FORM的简单 WPF是这东东还没用过
穿透?还是不显示鼠标的光标?