WPF绘图和动画-VisualBrush实例
来源:互联网 发布:mac不能拷贝到移动硬盘 编辑:程序博客网 时间:2024/06/15 14:36
《深入浅出WPF》(作者:刘铁猛)之学习笔记
WPF绘图和动画-VisualBrush实例
XAML代码:
<Window x:Class="VisualBrush实例.MainWindow" 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" xmlns:local="clr-namespace:VisualBrush实例" mc:Ignorable="d" Title="MainWindow" Height="300" Width="400"> <Grid Margin="10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="160"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="160"/> </Grid.ColumnDefinitions> <StackPanel x:Name="StackPanelLeft" Background="White"> <Button x:Name="RealButton" Content="OK" Height="40"/> </StackPanel> <Button Content=">>>" Grid.Column="1" Margin="5,0" Click="CloneVisual"/> <StackPanel x:Name="StackPanelRight" Background="White" Grid.Column="2"/> </Grid></Window>
C#代码 :
using System.Windows;using System.Windows.Media;using System.Windows.Shapes;namespace VisualBrush实例{ /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private double _opacity = 1.0;//不透明计数 private void CloneVisual(object sender, RoutedEventArgs e) { var vBrush=new VisualBrush(RealButton); var rect = new Rectangle { Width = RealButton.ActualWidth, Height = RealButton.ActualHeight, Fill = vBrush, Opacity = _opacity }; _opacity -= 0.2; StackPanelRight.Children.Add(rect); } }}
程序设计图:
程序运行图:
0 0
- WPF绘图和动画-VisualBrush实例
- WPF中使用VisualBrush的实例
- WPF学习之绘图和动画
- WPF学习第十二集-绘图和动画
- WPF学习之绘图和动画
- WPF学习之绘图和动画
- WPF学习之绘图和动画
- WPF 关于VisualBrush
- WPF:理解TileBrush(ImageBrush,DrawingBrush和VisualBrush)
- 自学WPF--第六课VisualBrush
- WPF-画刷、绘图、几何绘图、图形的效果与滤镜、图形变换和动画
- WPF放大镜程序-VisualBrush的使用
- Wpf(Storyboard)动画简单实例
- WPF绘图
- WPF中绘画和动画
- 绘图动画
- 使用SurfaceView实现异步动画绘图的小实例
- WPF中绘画和动画(2)
- Java-基本元素
- Python实现ssh登录执行shell命令并将结果写入mysql数据库
- 第124课:Spark Streaming性能优化:通过Spark Streaming进行设备日志监控报警及性能优化
- Unity3d:一个简单的画圈圈手势判断
- Android Studio lambda表达式使用配置
- WPF绘图和动画-VisualBrush实例
- K3表结构(一)
- 【python图像处理】几何图形的绘制与文字的绘制(ImageDraw类详解)
- More than one TaskScheduler and/or ScheduledExecutorService exist within the context
- JQuery中$.ajax()方法参数详解
- STM定时器中断问题
- IIS7网站看不到图片
- 第125课:Spark Streaming反思和启示:一切皆是流式处理及Spakr Streaming架构和运行机制
- C# linq连接SQL数据库