富文本框不一致

时间:2018-04-11 06:30:51

标签: wpf c#-4.0

我正在使用c#WPF。我有一些特定的模板,显示在富文本框中。这些模板在括号中有一些特定的单词。我想在点击TAB键时逐个选择括号中的那些单词。我用下面的代码编写了文本指针。但是这段代码不一致。该指数因系统而异。 有没有其他方法可以突出显示富文本框中的特定文本或我需要为富文本框设置的任何属性?

<Window x:Class="WpfApp1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:WpfApp1"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <TextBox   BorderBrush="Black"  MaxHeight="40"  TextChanged="txtPolicyNumber_TextChanged" LostKeyboardFocus="txtPolicyNumber_LostKeyboardFocus"  BorderThickness="1"  Margin="18,2,19,235" Text="" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible"  Width="480" Name="txtPolicyNumber"></TextBox>
    <RichTextBox   AcceptsReturn="True"   MaxHeight="200" BorderBrush="Black" BorderThickness="1"  TextChanged="rtxtMessage_TextChanged" KeyDown="rtxtMessage_KeyDown" Margin="18,48,19,-44" VerticalScrollBarVisibility="Visible" Name="rtxtMessage"  Width="480" ></RichTextBox>
</Grid>

0 个答案:

没有答案
相关问题