zoukankan      html  css  js  c++  java
  • WPF: Designer and Developer

    初次尝试,用Expression Blend设计动画,然后在VS 2008中通过编码将动画指派给需要它的控件,感觉不错。
    WPF is interesting! I'm a desinger and developer!!

    OutlookBar.xml:
    <UserControl x:Class="KingUCLs.OutlookBar"
        xmlns
    ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x
    ="http://schemas.microsoft.com/winfx/2006/xaml"
        Height
    ="300" Width="300">
        
    <UserControl.Resources>
            
    <Storyboard x:Key="Storyboard1">
                
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
                    
    <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.5"/>
                    
    <SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
                
    </DoubleAnimationUsingKeyFrames>
            
    </Storyboard>
        
    </UserControl.Resources>
        
    <Grid x:Name="gridMain">
            
    <StackPanel x:Name="stackPanel1">
            
    </StackPanel>
        
    </Grid>
    </UserControl>

    OutlookBar.xaml.cs
        public partial class OutlookBar : UserControl
        
    {
            
    private Storyboard _sButtonMouseEnter = null;
            
    public OutlookBar()
            
    {
                InitializeComponent();
                Button btnAdd 
    = new Button();
                btnAdd.Content 
    = "Add";
                btnAdd.Name 
    = "btnAdd";
                
    this.RegisterName(btnAdd.Name, btnAdd);

                Button btnDelete 
    = new Button();
                btnDelete.Content 
    = "Delete";
                btnDelete.Name 
    = "btnDelete";
                
    this.RegisterName(btnDelete.Name, btnDelete);

                stackPanel1.Children.Add(btnAdd);
                stackPanel1.Children.Add(btnDelete);

                _sButtonMouseEnter 
    = (Storyboard)this.FindResource("Storyboard1");
                
                btnAdd.MouseEnter 
    += new MouseEventHandler(onButtonMouseEnter);
                btnDelete.MouseEnter 
    += new MouseEventHandler(onButtonMouseEnter);
            }


            
    public void onButtonMouseEnter(object sender, RoutedEventArgs e)
            
    {
                Storyboard.SetTargetName(_sButtonMouseEnter, ((Button)sender).Name);
                _sButtonMouseEnter.Begin((Button)sender);
            }


        }

    }

    无需更多的语言了,又O了。
  • 相关阅读:
    自定义CollectionView实现流式布局和动态图片的展现
    Java设计模式之观察者模式
    HashMap工作原理
    SpringBoot 实现多线程
    十大排序算法
    IDEA集成 plant uml 画图工具
    解决国内访问github速度慢的问题
    SpringBoot整合JWT Token
    SpringBoot在idea中配置热部署
    Spring-Security教程【一】简单的登录认证
  • 原文地址:https://www.cnblogs.com/KingWorld/p/1018782.html
Copyright © 2011-2022 走看看