WPF_向文本应用转换

WPF_向文本应用转换

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

开发工具与关键技术: Visual Studio 2015 * SQL Server

作者:

撰写时间:2019年07月17日

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

应用变换可以改变应用程序中文本的显示。下面的实例使用不同类型的呈现变换来影响中文本的显示TextBlock控件。

下面实例使用RotateTransform 来旋转文本。Angle值为90,则元素会顺时针旋转90度。

<TextBlock FontFamily="Arial Black" FontSize="64" Foreground="Moccasin" Margin ="80, 10, 0, 0">

             Zhang Jie

        <TextBlock.RenderTransform>

            <RotateTransform Angle="90" />

        </TextBlock.RenderTransform>

    </TextBlock>

      

 

下面的代码实例使用 ScaleTransform对文本 从其原始大小进行缩放。

<Grid>

        <TextBlock

            Name="textblockScaleMaster" 

            FontSize="32"

            Foreground="MistyRose"

            Text="Zhangjie"

            Margin="100, 0, 0, 0"

            Grid.Column="0" Grid.Row="0">

        </TextBlock>

        <TextBlock

              FontSize="32"

              FontWeight="Bold" 

              Foreground="SteelBlue"

              Text="{Binding Path=Text, ElementName=textblockScaleMaster}"

              Margin="100, 0, 0, 0"

              Grid.Column="0" Grid.Row="1"> 

            <TextBlock.RenderTransform>

                <ScaleTransform ScaleX="1.5" ScaleY="1.0" />

            </TextBlock.RenderTransform>

        </TextBlock>

        <TextBlock

          FontSize="32"

          FontWeight="Bold" 

          Foreground="Red"

          Text="{Binding Path=Text, ElementName=textblockScaleMaster}"

          Margin="100, 0, 0, 0"

          Grid.Column="0" Grid.Row="2">

            <TextBlock.RenderTransform>

                <ScaleTransform ScaleX="1.0" ScaleY="1.5" />

            </TextBlock.RenderTransform>

        </TextBlock>

    </Grid>

下面实例演示沿X轴放大150%得到第二行文本,沿Y轴放大150% 得到第三行文本。

               

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值