0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Visual Studio / WPF > コントロール > ViewBox

Last updated at Posted at 2017-04-23
動作環境
Windows 7 Pro (32bit)
Microsoft Visual Studio 2017 Community
Sublime Text 2

@ WPF 4.5入門 by 大田一希さん
No.2074 / 9985

ViewBoxコントロールは、子要素を拡大縮小して表示するコントロールです。

Strechに「None」、「Fill」、「Uniform」、「UniformToFill」を使った例が紹介されている。

分光で試してみた。

XAML
<Window x:Class="_170423_t1935_border.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:_170423_t1935_border"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WrapPanel Margin="0, 30, 0, 0" Background="Black">
            <Viewbox Width="70" Height="50" Stretch="None">
                <Border BorderBrush="Violet" BorderThickness="15"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="Uniform">
                <Border BorderBrush="Blue" BorderThickness="5"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="Fill">
                <Border BorderBrush="LightBlue" BorderThickness="5"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="Uniform">
                <Border BorderBrush="LightGreen" BorderThickness="5"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="UniformToFill">
                <Border BorderBrush="Yellow" BorderThickness="5"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="Uniform">
                <Border BorderBrush="Orange" BorderThickness="5"></Border>
            </Viewbox>
            <Viewbox Width="70" Height="50" Stretch="UniformToFill">
                <Border BorderBrush="Red" BorderThickness="5"></Border>
            </Viewbox>
        </WrapPanel>
    </Grid>
</Window>

work.png

コレジャナイロボ発進!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?