zoukankan      html  css  js  c++  java
  • 六、画刷

    第一,找一个类的子类

    工程中的引用——〉打开windows——〉在浏览器中查找windows——〉在搜索框中输入父类——〉打开派生类型,即可。

    第二,给button添加背景色

    (1) 实心颜色画刷

    方法一:最常用和简单的      <Button Background="Red" />

    方法二:标准写法

           <Button>

             <Button.Background>
                        <SolidColorBrush Color="Gold"></SolidColorBrush> 
                    </Button.Background>

             </Button>

    方法三:<Button>

             <Button.Background> Gold </Button.Background>

             </Button>

    (2)线性渐变画刷

    <Button>

    <Button.Background>
                        <LinearGradientBrush>
                            <GradientStop Color="Red" Offset="0"></GradientStop>
                            <GradientStop Color="Yellow" Offset="0.7"></GradientStop>
                            <GradientStop Color="Blue" Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </Button.Background>

    </Button>

    歌词的效果
    第一步:在XAML中            <TextBlock Text="相信光明就在远方" FontSize="40" >
                    <TextBlock.Foreground>
                        <LinearGradientBrush>
                            <GradientStop Color="Yellow" ></GradientStop>
                            <GradientStop Color="Yellow" Offset="0.3"></GradientStop>
                            <GradientStop Color="Red" Offset="0.3"></GradientStop>
                            <GradientStop Color="Red"  Offset="1"></GradientStop>
                        </LinearGradientBrush>
                    </TextBlock.Foreground>
                </TextBlock>

    第二步:在歌词所在的.cs文件中的OnNavigatedTo方法中加入一个定时器(新建的是空白页)

    protected override void OnNavigatedTo(NavigationEventArgs e)        

    {            

              DispatcherTimer timer = new DispatcherTimer();           

               timer.Interval = TimeSpan.FromMilliseconds(200);//每200毫秒,定时器执行一次         

               timer.Tick += timer_Tick;            

               timer.Start();

            }

            void timer_Tick(object sender, object e)       

      {            

                 gs1.Offset += 0.01;            

                 gs2.Offset += 0.01;      

       }

  • 相关阅读:
    ubuntu分屏终端
    Xcode-5.1.1更改文件盯作者
    Swift——(两)Swift访问元组
    Android Loader使用,屏幕解锁,重复荷载
    医疗信息季节:第二十三届中国国际医疗仪器设备展览会暨研讨会 思考
    UIBarButtonItem 小记边
    L轻松学习inux教程5 知识与学习bash
    Android 教你打造炫酷的ViewPagerIndicator 不仅仅是高仿MIUI
    Android Context 上下文 你必须知道的一切
    Android 自定义控件 优雅实现元素间的分割线 (支持3.0以下)
  • 原文地址:https://www.cnblogs.com/suinuaner/p/six.html
Copyright © 2011-2022 走看看