1

与えられたレイアウトでウィンドウを作成しようとしていますが、それを行うための最良の方法に興味があります。ウィンドウの背景を明るい色のタイル画像に設定しました。次に、5列のユニフォームグリッドと5列目の1行を追加し、背景が「オレンジ」のわずかに透明になるように考えました。次に、同じ「オレンジ」の色設定で、5行と1列の2行目と3行目の均一なグリッドを追加します。最終的には、左上隅に会社のロゴを追加し、「オレンジ」の水平方向の帯にテキストを追加します。私の方法はうまくいかないようです:-(私がこれを自分で調べているので、どんなガイダンスも大いにありがたいです。例

4

2 に答える 2

2

これは私にとってうまく機能します:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0" Background="Yellow">
            <Image Source="http://www.google.com/images/srpr/logo3w.png"
                   HorizontalAlignment="Left"/>
        </Grid>
        <Grid Grid.Row="0" Grid.Column="1" Background="Orange"/>
        <Grid Grid.Row="1" Grid.Column="0" Background="Orange"/>
        <Grid Grid.Row="1" Grid.Column="1" Background="Red"/>
        <Grid Grid.Row="2" Grid.Column="0" Background="Yellow"/>
        <Grid Grid.Row="2" Grid.Column="1" Background="Orange"/>
        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0">
            I am nice text spanning the whole row! Look, here's a lot
            of me in the cell.
        </TextBlock>
    </Grid>
</Page>

半透明のストライプを主張すると、次のようなものを作ることができます

<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1"
      Background="Orange" Opacity="0.5"/>

また

<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1" Background="#80FF7F00"/>

(色に不透明度を含める)など。

たとえば、これを試してください(色を微調整する必要があります):

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:sys="clr-namespace:System;assembly=mscorlib"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
              Background="Yellow" Opacity="0.5"/>
        <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
              Background="Orange" Opacity="0.5"/>
        <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
              Background="Yellow" Opacity="0.5"/>
        <Grid Grid.Row="0" Grid.Column="0" Grid.RowSpan="3"
              Background="Yellow" Opacity="0.5"/>
        <Grid Grid.Row="0" Grid.Column="1" Grid.RowSpan="3"
              Background="Orange" Opacity="0.5"/>
        <Image Grid.Row="0" Grid.Column="0"
               Source="http://www.google.com/images/srpr/logo3w.png"
               HorizontalAlignment="Left"/>
        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0">
            I am nice text spanning the whole row! Look, here's a lot
            of me in the cell.
        </TextBlock>
    </Grid>
</Page>
于 2012-07-01T18:26:51.167 に答える
1

簡単な答えは、グリッドを使用し、セルの背景色を選択した色にわずかに透明に設定することでした。次に、交差するセルをより暗い色に設定するか、交差するセルに同じ背景と透明度でラベルを追加します。ご協力ありがとうございました。この 1 時間で、xaml と WPF について多くのことを学びました。

于 2012-07-01T20:28:23.257 に答える