WPF里面的常用笔刷
生活随笔
收集整理的這篇文章主要介紹了
WPF里面的常用笔刷
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?程序運行效果
?
<Window x:Class="This_brush.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow" Height="350" Width="525"><Grid><Canvas Width="200" Height="200" Background="Black" Opacity="1" Margin="5,5,317,119" x:Name="Canvas1"> <!--Canvas 絕對坐標布局的容器--><TextBox Width="100" Height="40" Canvas.Left="5" Canvas.Top="5" Background="White" FontSize="25"><TextBlock.Foreground> <!--控件的前景色--><ImageBrush ImageSource="C:\Users\mztli_000\Pictures\From 夢斷難尋\Camera roll\WP_20130919_002.jpg"/> <!--ImageBrush圖片筆刷 可以用圖片填充所有支持Brush對象作為參數的控件屬性--></TextBlock.Foreground></TextBox><TextBox Width="100" Height="40" Canvas.Left="5" Canvas.Top="50"><TextBox.Background> <!--控件的背景色--><SolidColorBrush Color="Aqua"/> <!--SolidColorBrush實心筆刷,可以用純色填充所有支持Brush對象的控件屬性--></TextBox.Background></TextBox></Canvas><Rectangle Height="100" Margin="407,5,0,0" Stroke="Black" VerticalAlignment="Top" Width="100"> <!--矩形--><Rectangle.Fill> <!--矩形的填充屬性--> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <!--線性漸變筆刷,StartPoint屬性是開始點的位置(0,0),EndPoint是結束點的位置(1,1),并且他們是相對坐標--><GradientStop Color="Red" Offset="0.1"/> <!--描述漸變中過渡點的位置和顏色 Offser屬性是獲取漸變停止點在漸變向量中的位置。起始點為0,開始點為1 --><GradientStop Color="Green" Offset="0.75"/><GradientStop Color="Yellow" Offset="1"/></LinearGradientBrush></Rectangle.Fill></Rectangle><Ellipse Width="100" Height="100" Margin="266,20,151,199"><Ellipse.Fill><RadialGradientBrush GradientOrigin="0.1,0.1"> <!--放射狀漸變筆刷,GradientOrigin屬性是調整放射中心點的位置,坐標最大為1,如果超過的話將會導致中心點丟失,現在設置為0.1,0.1就是代表左上角的位置,做出了一個燈光效果--><GradientStop Color="White" Offset="0"/><GradientStop Color="Black" Offset="1"/></RadialGradientBrush></Ellipse.Fill></Ellipse></Grid> </Window>?
轉載于:https://www.cnblogs.com/mdnx/p/3446798.html
總結
以上是生活随笔為你收集整理的WPF里面的常用笔刷的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: shell编程的一些例子4
- 下一篇: 【IBatisNet Spring.N