WPF邊框不同形式的設置技巧
作者:佚名
WPF邊框的設置方法要向熟練的掌握,首先就需要通過實踐去不斷積累經驗,來牢固我們已經掌握的書面知識。
WPF開發工具為我們帶來了不一樣的編程環境。對于這樣一款新型的圖形界面處理工具,有許多地方值得我們去學習?,F在我們先來了解下WPF邊框相關設置方法。#t#
WPF邊框設置樣式代碼示例:
- < ResourceDictionary
- xmlns="http://schemas.microsoft.
com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.
com/winfx/2006/xaml" - >
- < Style x:Key="RacePitBorderStyle"
TargetType="Border"> - < Style.Resources>
- < LinearGradientBrush x:Key=
"RacePitBackgroundBrush" StartPoint=
"0.5,0" EndPoint="0.5,1"> - < GradientStop Color="#88000000"
Offset="0.1" /> - < GradientStop Color="#CC000000"
Offset="0.9" /> - < /LinearGradientBrush>
- < LinearGradientBrush x:Key=
"RacePitBorderBrush" StartPoint=
"0.5,0" EndPoint="0.5,1"> - < GradientStop Color="#18000000"
Offset="0.1" /> - < GradientStop Color="#08000000"
Offset="0.9" /> - < /LinearGradientBrush>
- < /Style.Resources>
- < Setter Property="Background"
Value="{StaticResource RacePit
BackgroundBrush}" /> - < Setter Property="BorderBrush"
Value="{StaticResource RacePit
BorderBrush}" /> - < Setter Property="BorderThic
kness" Value="1" /> - < Setter Property="CornerRadius"
Value="8" /> - < Setter Property="Margin"
Value="2,4" /> - < /Style>
- < /ResourceDictionary>
定義相應的WPF邊框樣式資源:
RacePitBackgroundBrush
RacePitBorderBrush
類型是WPF邊框,設置相應的屬性如下:
Background
BorderBrush
BorderThickness
CornerRadius
Margin
責任編輯:曹凱
來源:
博客園