RichTextBox 项目符号点对齐显示问题(左、中和右)
RichTextBox Bullet Points Alignment Display Issue (Left, Centre, and Right)
输入 'email composure' 表单时出现以下显示问题:
我有左对齐、居中对齐和右对齐的项目符号点。要使选定的文本项目符号点列表样式,将激活一个按钮,该按钮执行以下操作:
chkBullet.CheckState = If(isSelectionBulletList(richTextBox), CheckState.Checked, CheckState.Unchecked)
这反过来将段落激活为项目符号列表:
Private Function isSelectionBulletList(RichTextBox As RichTextBox) As Boolean
Dim startParagraph As Paragraph = RichTextBox.Selection.Start.Paragraph
If startParagraph IsNot Nothing Then
If TypeOf (startParagraph.Parent) Is ListItem Then
Dim markerStyle As TextMarkerStyle = CType(startParagraph.Parent, ListItem).List.MarkerStyle
If markerStyle = TextMarkerStyle.Disc Then
Return True
End If
End If
End If
Return False
End Function
要将突出显示的项目符号点移动到所需的对齐方式,我运行宁以下:
Align(0).Checked =
(CType(richTextBox.Selection.GetPropertyValue(Paragraph.TextAlignmentProperty), TextAlignment) =
TextAlignment.Left)
它正确地移动了文本,但没有移动带文本的项目符号。
我稍后 运行 一个 RTF 到 HTML 的转换,然后将电子邮件发送到我的收件箱,并且项目符号正确对齐,如下所示:
有谁知道我该如何解决这个显示问题?
似乎没有立即解决此问题的方法。
一位更有经验的同事建议解决此问题的方法是使用 RichTextBox 创建一个 自定义 WPF 控件,在它的地方。
根据 Microsoft 论坛主题,请参阅此处了解已知问题:https://social.msdn.microsoft.com/Forums/vstudio/en-US/efbd8f0a-4f6d-4e7b-8988-cc17a02e354b/wpf-applying-alignment-to-a-list-in-a-rich-text-box?forum=wpf
输入 'email composure' 表单时出现以下显示问题:
我有左对齐、居中对齐和右对齐的项目符号点。要使选定的文本项目符号点列表样式,将激活一个按钮,该按钮执行以下操作:
chkBullet.CheckState = If(isSelectionBulletList(richTextBox), CheckState.Checked, CheckState.Unchecked)
这反过来将段落激活为项目符号列表:
Private Function isSelectionBulletList(RichTextBox As RichTextBox) As Boolean
Dim startParagraph As Paragraph = RichTextBox.Selection.Start.Paragraph
If startParagraph IsNot Nothing Then
If TypeOf (startParagraph.Parent) Is ListItem Then
Dim markerStyle As TextMarkerStyle = CType(startParagraph.Parent, ListItem).List.MarkerStyle
If markerStyle = TextMarkerStyle.Disc Then
Return True
End If
End If
End If
Return False
End Function
要将突出显示的项目符号点移动到所需的对齐方式,我运行宁以下:
Align(0).Checked =
(CType(richTextBox.Selection.GetPropertyValue(Paragraph.TextAlignmentProperty), TextAlignment) =
TextAlignment.Left)
它正确地移动了文本,但没有移动带文本的项目符号。
我稍后 运行 一个 RTF 到 HTML 的转换,然后将电子邮件发送到我的收件箱,并且项目符号正确对齐,如下所示:
有谁知道我该如何解决这个显示问题?
似乎没有立即解决此问题的方法。
一位更有经验的同事建议解决此问题的方法是使用 RichTextBox 创建一个 自定义 WPF 控件,在它的地方。
根据 Microsoft 论坛主题,请参阅此处了解已知问题:https://social.msdn.microsoft.com/Forums/vstudio/en-US/efbd8f0a-4f6d-4e7b-8988-cc17a02e354b/wpf-applying-alignment-to-a-list-in-a-rich-text-box?forum=wpf