1,跨屏最大化
单屏幕的时候我们可以设置 WindowState 来使应用最大化
当接多个屏幕的时候,就需要下面这个设置:
private void FullScreen() { this.WindowState = WindowState.Normal; this.WindowStyle = System.Windows.WindowStyle.None; this.ResizeMode = System.Windows.ResizeMode.NoResize; this.Left = 0; this.Top = 0; this.Width = System.Windows.SystemParameters.VirtualScreenWidth; this.Height = System.Windows.SystemParameters.VirtualScreenHeight; }
或者在 XAML 中
WindowState="Normal" WindowStyle="None" ResizeMode="NoResize" Left="0" Top="0" Height="{x:Static SystemParameters.VirtualScreenHeight}" Width="{x:Static SystemParameters.VirtualScreenWidth}"
来自:http://www.cnblogs.com/infly123/p/3818534.html
2,动画的暂停、继续、停止
在 XAML 中:
<Button Content="Click Me"> <Button.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Name="OpacityStoryboard"> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="(UIElement.Opacity)" From="0" To="1" RepeatBehavior="Forever" AutoReverse="True" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="UIElement.MouseEnter"> <PauseStoryboard BeginStoryboardName="OpacityStoryboard" /> </EventTrigger> <EventTrigger RoutedEvent="UIElement.MouseLeave"> <ResumeStoryboard BeginStoryboardName="OpacityStoryboard" /> </EventTrigger> </Button.Triggers> </Button>
来自:http://www.cnblogs.com/tommy-huang/p/6496748.html
在后台代码里,可以使用:
Storyboard myStoryboard = new Storyboard(); myStoryboard.Pause(this); myStoryboard.Resume(this);
但你如果要使用以上代码,一定要注意必须设置:
myStoryboard.Begin(this, true);
可以利用 myStoryboard.GetIsPaused(this); 来判断当前动画是否在暂停状态
3,窗体对象的操作:
http://www.cnblogs.com/BABLOVE/p/3234035.html
4,背景透明
AllowsTransparency="True" Background="Transparent" WindowStyle="None"
时间: 2024-10-10 05:21:46