• 六、画刷


    第一,找一个类的子类

    工程中的引用——〉打开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;      

       }

  • 相关阅读:
    XMLHttpRequest 对象相关
    slideToggle()---单击隐藏/浮现--jQuery--click() 方法
    如何打开无线网卡开关(常见无线网卡开关样式)-----记一次令人脸红的羞耻操作
    之前写的页面导出Excel表格
    word 快捷键 部分
    windows 快捷键 部分
    推荐几款屏幕录制工具(可录制GIF)
    【myeclipse2014-2017】使用相关
    嵌套的JsonObject与JSONArray的取值---JSON中嵌套JSONArray
    图片素材库
  • 原文地址:https://www.cnblogs.com/suinuaner/p/six.html
Copyright © 2020-2023  润新知