gpt4 book ai didi

wpf - 在 TextBox/RichTextBox 中 block 选择

转载 作者:行者123 更新时间:2023-12-01 02:35:11 25 4
gpt4 key购买 nike

我正在开发记事本克隆。我想在 textpad 中实现块选择(垂直选择)。我该怎么做?

Textpad Block Select

编辑:
我不知道这个问题应该添加什么样的细节。然而,这是我的代码。我需要向这个文本框添加块选择功能。

<TextBox Name="txtContentBox"
Text="{Binding Content, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Stretch"
Background="White"
Foreground="#111111"
BorderThickness="0"
FontSize="{Binding FontSize}"
FontFamily="{Binding CurrentFont}"
FontStyle="{Binding IsItalic, Converter={StaticResource BoolToFontStyle}, ConverterParameter=Italic}"
FontWeight="{Binding IsBold, Converter={StaticResource BoolToFontWeight}, ConverterParameter=Bold}"
TextWrapping="{Binding IsWrap, Converter={StaticResource BoolToWrap}}"
SelectionBrush="#6674AAE2"
AcceptsReturn="True"
AcceptsTab="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
AllowDrop="True"
SnapsToDevicePixels="False"
MouseMove="txtContentBox_MouseMove"
PreviewMouseDown="txtContentBox_PreviewMouseDown"
PreviewMouseUp="txtContentBox_PreviewMouseUp">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged">
<cmd:EventToCommand Command="{Binding HandleChangesCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewMouseWheel">
<cmd:EventToCommand Command="{Binding IncDecFontSizeCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="Drop">
<cmd:EventToCommand Command="{Binding OpenCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewDragEnter">
<cmd:EventToCommand Command="{Binding PreviewDraggedFileCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="PreviewDragOver">
<cmd:EventToCommand Command="{Binding PreviewDraggedFileCommand}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>

最佳答案

您可以使用 AvalonEdit .它是具有此功能以及更多功能的 native WPF 编辑器。

关于wpf - 在 TextBox/RichTextBox 中 block 选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10563865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com