0

ちょっと困っています。ページをテキストボックス内のテキストで最大化したいのですが、テキストボックスの境界線でしかページを最大化できません。誰でも私を助けることができますか?

これを正しく行うことが非常に重要です。回転したテキストの右端のピクセルと同じくらい、境界線から左端のピクセルを取得する必要があります。

一番下に「最初の行」の XAML コードを貼り付けます。「別の行」のコードは、サイズと場所が固定されているだけなので、その部分を切り取りました。

<Viewbox Height="3000" HorizontalAlignment="Stretch"  VerticalAlignment="Bottom"  Width="Auto">
    <TextBox Text="First line" BorderThickness="0" VerticalContentAlignment="Bottom"  >
        <TextBox.LayoutTransform>
            <RotateTransform Angle="-35"/>
        </TextBox.LayoutTransform>
    </TextBox>
</Viewbox>
4

1 に答える 1

0

編集済み:テキストボックスをボーダーの子に設定し、余白を設定してから(テキストボックスの代わりに)ボーダーを回転させる必要があります(コメントを参照);

<Window ....
    Height="600"
    Width="400">
<Grid>
    <Viewbox 
             HorizontalAlignment="Stretch"
             VerticalAlignment="Stretch">
       <Border Background="AliceBlue">
            <TextBox AcceptsReturn="True"
                     Margin="-4"
                     BorderThickness="0"
                     Background="Transparent">

                <TextBox.Text>
                    First line and more and more ansd
                </TextBox.Text>
            </TextBox>
            <Border.LayoutTransform>
                <RotateTransform Angle="-35" />
            </Border.LayoutTransform>
        </Border>
    </Viewbox>
</Grid>
</Window>
于 2012-11-21T07:58:02.060 に答える