zoukankan      html  css  js  c++  java
  • WPF Strange TextBlock Bug ,

    1. add  textblock  on  ui , as bellow:

    <Grid>

    <TextBlock Height="23" HorizontalAlignment="Left" Margin="16,18,0,0" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top" />

    </Grid>

    1. add style for textBlock

       <Window.Resources>

            <Style   TargetType="{x:Type TextBlock}">

                <Setter Property="HorizontalAlignment" Value="Left"/>

                <Setter Property="VerticalAlignment" Value="Center"/>

                <Setter Property="Foreground" Value="#ffffffff"/>

                <Setter Property="FontSize" Value="16px"/>

                <Setter Property="MinHeight" Value="50"/>

                <Setter Property="Margin" Value="16,6,0,6"/>

                <Setter Property="Padding" Value="4,8,4,4"/>

                <Setter Property="MaxWidth" Value="332"/>

                <Setter Property="TextWrapping" Value="Wrap"/>

            </Style>

        </Window.Resources>

    1. set textblock property using cs code , as bellow:

            public MainWindow()

            {

                InitializeComponent();

                Loaded += new RoutedEventHandler(MainWindow_Loaded);

            }

     

            void MainWindow_Loaded(object sender, RoutedEventArgs e)

            {

                textBlock1.Text = "Tasti con caartteri";

            }

    1.  Run application ,display as bellow:

     

    1. Why? I set Text Property textBlock1.Text = "Tasti con caartteri" , but display on ly “Tasti con”

    The last word is missing.

    If  you  change  any    letter  in this word,it display ok.

    If  you  add  any    letter  in this word,it display ok.

    If  you delete style  <Setter Property="TextWrapping" Value="Wrap"/> , ,it display ok

    If  you delete style  <Setter Property="Padding" Value="4,8,4,4"/>, ,it display ok.

    If  you change fontsize to 15px,it display ok.

    1. Please find a reason for this,thank you!

     Demo DownLoad

  • 相关阅读:
    应用Druid监控SQL语句的执行情况
    J2EE应用监控后台执行SQL
    maven环境搭建
    【机器学习】Sklearn库主成分分析PCA降维的运用实战
    PCA降维算法
    80行Python实现-HOG梯度特征提取(转载)
    HOG特征提取算法原理(转载)
    数据预处理方法 总结
    【AI换脸】Faceswap源代码换脸软件安装指南(转)
    人工智能领域的会议和期刊(转载)
  • 原文地址:https://www.cnblogs.com/xiaokang088/p/2012197.html
Copyright © 2011-2022 走看看