Rectangleを使う WPFRectangleを使う WPFこれといった特徴が無い?かもしれない、Rectangle。グリッドと何が違うのか? と言う素朴な疑問は、Rectangleには、Stroke「枠線らしい」がある。グリッドには無い。 何に使うのか今一思いつかないが、こんなものがあったよな~と覚えておくと、きっと役に立つコントロールです。
<Window x:Class="Rectangle"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Rectangle" Height="300" Width="300">
<Grid Opacity="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Row="0" Grid.ColumnSpan="2" Stroke="#FF001900" Fill="#7A0000FF"/>
<Rectangle Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="3" Name="Rectangle1" Stroke="Black" Fill="#FFFB0000" Opacity="0.5" StrokeThickness="5" />
<Grid Grid.Column="2" Grid.Row="3" Background="DarkGoldenrod" Opacity="0.5"/>
</Grid>
</Window>
|