在RichTextBox中将选择的文本设置为粗体

编程入门 行业动态 更新时间:2024-10-11 19:21:41
本文介绍了在RichTextBox中将选择的文本设置为粗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在报表上的MS-Access RichTextBox中,我要选择粗体文本.

In an MS-Access RichTextBox on a Report, I want to make a selection of the text bold.

我发现此帖子在论坛上,该论坛说明了如何在VB6中执行此操作.我在MS-Access中尝试了相同的方法,但都将普通的Access文本框的Text Format属性设置为Rich Text,并且将Microsoft Forms 2.0 TextBox通过ActiveX Controls对话框添加了,但都无效.

I found this post on a forum which explains how to do this in VB6. I tried the same in MS-Access, both with a normal Access textbox with the Text Format property set to Rich Text and a Microsoft Forms 2.0 TextBox added via the ActiveX Controls dialogue box, neither works.

我知道VBA很大程度上基于VB6,所以我的逻辑是,如果可以在VB6中完成,那么我应该能够在Access中做到这一点.

I know VBA is based heavily on VB6 so my logic is if it can be done in VB6, I should be able to do it in Access.

我是对的吗?是否可以在MS-Access上的RichTextBox内将选择的文本设置为粗体?

Am I right? Is it possible to set a selection of text to bold inside a RichTextBox on MS-Access?

推荐答案

您没有提到Access的版本,对于2007(AFAIK)和2010,您可以创建一个文本框并将数据"选项卡上的文本格式"设置为丰富"文本.然后,您可以将控制源设置为:

You do not mention the version of Access, for 2007 (AFAIK) and 2010, you can create a textbox and set the Text Format on the data tab to Rich Text. You can then set the Control Source to:

="The quick <b>brown</b> fox"

在表格设计中,备忘录数据类型具有富文本格式"选项.

In table design, the memo data type has a Rich Text option.

来自包含来自字段的数据的格式丰富的文本

出于多种原因,富文本控件不支持 完整的HTML范围,但集中围绕HTML的有限子集 格式化文本.如果您坚持使用HTML标签和属性列表 在下面,您应该很安全:

For a number of reasons the rich text control doesn't support the full range of HTML but rather a limited subset of HTML focused around formatting text. If you stick to the list of HTML tags and attributes below you should be safe:

<font face="Arial Black" size=3 color="#A5A5A5" style="Background-Color:#FFFF00"> <strong> <em> <u> <br> <div align=right dir=RTL> <blockquote> <ol> and <li> for number <ul> and <li> for bulleted lists

更多推荐

在RichTextBox中将选择的文本设置为粗体

本文发布于:2023-11-10 14:34:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575641.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   中将   粗体   文本   RichTextBox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!