在RichTextBox中将选择的文本设置为粗体 [英] Set a selection of text to bold inside a RichTextBox

查看:153
本文介绍了在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中将选择的文本设置为粗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆