想在工作中实现一个透明无边框并且具有动画功能的悬浮球,如图片所示,但在网上搜了之后发现发现使用wpf实现的基本没有,所以将自己实现的过程放在这里,希望给需要的一个方便,过程是这样的:
<Window
x:Class="WPFFloatBall.View.FloatAlarmWIndow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="FloatAlarmWIndow"
Width="100"
Height="100"
AllowsTransparency="True"
Background="Transparent"
ResizeMode="NoResize"
ShowInTaskbar="False"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
<Window.Resources>
<FontFamily x:Key="DigitalFontFamily">pack://application:,,,/Resource/Font/#Digital</FontFamily>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="8*" />