vba 您可以更改 MS Access 中选定文本的默认颜色吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8173676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 14:28:26  来源:igfitidea点击:

Can you change the default color for selected text in MS Access?

ms-accessvbaaccess-vba

提问by MultiGuy

I haven't found an existing post about this so I'll give it a shot.

我还没有找到关于这个的现有帖子,所以我会试一试。

I'd like to know if there is a way to change the default highlight color for selected text? Right now, whenever I invoke .SetFocuson a field, Access "selects" the contents of the field. The color it uses is black, and makes the data very hard to see. Is there a way to change that color?

我想知道是否有办法更改所选文本的默认突出显示颜色?现在,每当我.SetFocus在一个字段上调用时,Access 都会“选择”该字段的内容。它使用的颜色是黑色,这使得数据很难看清。有没有办法改变这种颜色?

采纳答案by mwolfe02

Access simply swaps the background and foreground color as its means of highlighting text in a text box. As far as I know there is no way to change this behavior.

Access 只需交换背景色和前景色,作为突出显示文本框中文本的方式。据我所知,没有办法改变这种行为。

Obviously you can change the foreground and background colors themselves, but there is no separate "highlight" color that you can set independent of the foreground/background.

显然,您可以自己更改前景色和背景色,但是没有单独的“突出显示”颜色可以独立于前景/背景进行设置。

回答by GazB

Although this isn't specificity for List Boxes I still think it is worth a note that List Boxes work slightly different (not sure why... maybe a different developer!) the selected row on a list box will invertsthe colour of the background and foreground separately instead of swapping them.

虽然这不是列表框的特殊性,但我仍然认为值得一提的是,列表框的工作方式略有不同(不知道为什么......可能是不同的开发人员!)列表框上的选定行将反转背景的颜色和前景分开而不是交换它们。

For example if you had a light blue text on a white background normally the selected row would be a red text on a black background. The white inverts to black and the light blue inverts to red.

例如,如果您在白色背景上有浅蓝色文本,通常所选行将是黑色背景上的红色文本。白色反转为黑色,浅蓝色反转为红色。

Or if you had

或者如果你有

Not sure which method I like better but it would be nice if they where the same! Makes UI's look a lot better when they are consistent throughout the form!

不确定我更喜欢哪种方法,但如果它们相同,那就太好了!当它们在整个表单中保持一致时,使 UI 看起来好多了!

回答by Luke

Sometimes this problem can be caused by using a transparent text box on a background that is the same or similar color (with contrasting-colored text). Make sure you have the text box back color set to a same/similar color as the background.

有时,在相同或相似颜色(带有对比色文本)的背景上使用透明文本框可能会导致此问题。确保将文本框的背景颜色设置为与背景相同/相似的颜色。

Basically, you need the text box back color to contrast with the text. When highlighted, the highlight will be a contrasting color to the text box background color.

基本上,您需要文本框的背景颜色与文本形成对比。突出显示时,突出显示将是与文本框背景颜色形成对比的颜色。