TextBlock
记录一次openpyx使用rich_text报错AttributeError: 'TextBlock' object has no attribute 'name'
先说解决办法: pip install lxml 报错截图: 当时在两个环境中分别使用相同版本openpyxl,相同的代码,一个环境中能成功,另外一个一直报错。 排查结果如下: 根据报错找到文件: File "\openpyxl\worksheet_writer.py", line 147, in ......
WPF TextBlock 文本纵向排列(旋转90度)
文字旋转90度,纵向排列。 效果: <TextBlock Text="压 降 (mV)" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="8"> <TextBlock.LayoutTransform> <!--文字同样旋转90度--> ......
WPF TextBlock显示固定长度字符串
页面中TextBlock控件内容 <TextBlock x:Name="name" HorizontalAlignment="Left" Text="{Binding Name,Converter={StaticResource StringMaxLenConverter},ConverterPar ......
WPF Textblock标签下 Run标签-----显示空白或者消除空白
消除Run之前的空白是将Run标签布局时头尾相连,如下: <TextBlock > <Run Text="A"></Run> <Run Text="B"></Run> </TextBlock> 消除Run之间连接的空白格式,方式如下: <TextBlock > <Run Text="A"></Run ......
WPF使用TextBlock实现查找结果高亮显示
在应用开发过程中,经常遇到这样的需求:通过关键字查找数据,把带有关键字的数据显示出来,同时在结果中高亮显示关键字。在web开发中,只需在关键字上加一层标签,然后设置标签样式就可以轻松实现。 在WPF中显示文本内容通常采用`TextBlock`控件,也可以采用类似的方式,通过内联流内容元素`Run`达 ......
WPF中TextBlock文本换行与行间距
换行符: C#代码中:\r\n 或 \r 或 \n XAML中:
 或 
 注:\r 回车 (carriage return 缩写),\n 新行 (new line 缩写)。 行间距: LineHeight属性 示例: <TextBlock LineHeight="20" Tex ......
WPF 监听TextBlock 的Text改变事件
private static System.ComponentModel.DependencyPropertyDescriptor descriptor = System.ComponentModel.DependencyPropertyDescriptor.FromProperty(TextBlo ......