格式化TextBox显示(非固定宽度字体) [英] Formatting TextBox display (non-fixed width fonts)

查看:46
本文介绍了格式化TextBox显示(非固定宽度字体)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我们的软件中种植复活节彩蛋。


我们有一个多行的TextBox,用于显示各种

消息我们的操作员的屏幕基于数据库查询等。


我想创建的复活节彩蛋会发送一个数据转储,用于

特定部分当按下

字符的某个秘密组合时,屏幕上的数字。如果它运作良好,我实际上可以在我们的生产车间兑现它。


我可以读取数据并将其拆分在字段中需要进入,但

TextBox的字体是Arial,并且不太擅长显示表格数据。


如果我将字体更改为像Courier这样固定的东西,改变将是非常明显的。


有没有人知道我可以用来确保每个字段的技术

我想在MultiLine TextBox中显示只占用额外的

空间?


首先想到SubString,但是用空格填充一个字段不会

将我的下一个字段放到正确的位置。


标签看起来不错,但我怎么能确切知道空间有多大vbTab要消耗?b $ b消费?如果文本运行怎么办?

I want to plant an Easter Egg in our software.

We have a TextBox that is multiline and used to display all sorts of
messages on the screen for our operators based on database queries and such.

The Easter Egg I want to create would send a dump of the data for a
particular part number to the screen when a certain secret combination of
characters is pressed. If it works out well, I can actually impliment it on
our production floor.

I can read in the data and split it up in the fields it needs to be in, but
the TextBox''s font is Arial, and not very good at displaying tablular data.

If I change the font to something fixed like Courier, the change will be
very obvious.

Does anyone know of a technique that I could use to make sure each field
that I want to display in the MultiLine TextBox only takes up set amount of
space?

SubString came to mind at first, but padding a field with spaces would not
get my next field to the correct position.

Tabs seem nice, but how can I tell exactly how much space a vbTab is going
to consume? What if text runs over?

推荐答案

我想我找到了解决办法:我可以使用RichTextBox代替标准

TextBox。


如果有人有更好的解决方案,我还在这里。


" jp2msft"写道:
I think I found a work-around: I can use a RichTextBox instead of a standard
TextBox.

If anyone has a better solution, I''m still here.

"jp2msft" wrote:

我想在我们的软件中种植一个复活节彩蛋。


我们有一个多行的TextBox在屏幕上为我们的操作员显示基于数据库查询等的各种

消息。


我要创建的复活节彩蛋会发送转储当按下

字符的某个秘密组合时,屏幕上某个特定部件号的数据。如果它运作良好,我实际上可以在我们的生产车间兑现它。


我可以读取数据并将其拆分在字段中需要进入,但

TextBox的字体是Arial,并且不太擅长显示表格数据。


如果我将字体更改为像Courier这样固定的东西,改变将是非常明显的。


有没有人知道我可以用来确保每个字段的技术

我想在MultiLine TextBox中显示只占用额外的

空间?


首先想到SubString,但是用空格填充一个字段不会

将我的下一个字段放到正确的位置。


标签看起来不错,但我怎么能确切知道空间有多大vbTab要消耗?b $ b消费?如果文本结束怎么办?
I want to plant an Easter Egg in our software.

We have a TextBox that is multiline and used to display all sorts of
messages on the screen for our operators based on database queries and such.

The Easter Egg I want to create would send a dump of the data for a
particular part number to the screen when a certain secret combination of
characters is pressed. If it works out well, I can actually impliment it on
our production floor.

I can read in the data and split it up in the fields it needs to be in, but
the TextBox''s font is Arial, and not very good at displaying tablular data.

If I change the font to something fixed like Courier, the change will be
very obvious.

Does anyone know of a technique that I could use to make sure each field
that I want to display in the MultiLine TextBox only takes up set amount of
space?

SubString came to mind at first, but padding a field with spaces would not
get my next field to the correct position.

Tabs seem nice, but how can I tell exactly how much space a vbTab is going
to consume? What if text runs over?


我想我找到了解决办法:我可以使用RichTextBox而不是标准的
I think I found a work-around: I can use a RichTextBox instead of a standard

TextBox。
TextBox.



你打败了我 - 一个RTB是一个很好的解决方案。您可以将RTB的

DefaultFont属性设置为Arial字体,并且可以以等宽字体(如Courier New)插入表格数据

。当新的需求出现时,您还可以添加

突出显示(例如颜色)等等。我建议你用你的应用程序工作,因为它现在使用RTB替换文本框,并且

不应该花太长时间,因为RTB和TextBox都继承了TextBoxBase。 br />

You beat me to the punch - an RTB is a good solution. You can set the RTB''s
DefaultFont property to an Arial font, and you can insert your tabular data
in a monospace font (like Courier New). You will also be able to add
highlighting (eg color) and so forth as new needs arise. I suggest you make
your app work as it does now with an RTB replacing the textbox, and that
should not take too long since RTB and TextBox both inherit TextBoxBase.


我目前的任务是找出如何在RTB中包含混合字体,

但是如果你'我很乐意帮助,这太棒了!


假设我的RTB包含Arial字体的几行现有文本,我想要

来附加一些Courier New的新文章。怎么办?它是否类似格式化HTML(即< font name =''courier new''> New Text< / font>)或

....?


这可以为我的应用程序打开一个新的venu!


RTB可以创建/显示一个表吗?


如果您知道一个很好的在线资源,那就是我所需要的! :)


" AMercer"写道:
I''m currently on a mission to find out how to include mixed fonts in a RTB,
but if you''d care to help, that would be fantastic!

Say my RTB contains several lines of existing text in Arial font, and I want
to append some new text to it in Courier New. How would that be done? Is it
similar to formatting HTML (i.e. <font name=''courier new''>New Text</font>) or
....?

This could open up a new venu for my application!

Can a RTB create/display a table?

If you know of a nice online source for this, that''s all I need! :)

"AMercer" wrote:

我想我找到了解决办法:我可以使用RichTextBox代替标准

TextBox。
I think I found a work-around: I can use a RichTextBox instead of a standard
TextBox.



你打败了我 - 一个RTB是一个很好的解决方案。您可以将RTB的

DefaultFont属性设置为Arial字体,并且可以以等宽字体(如Courier New)插入表格数据

。当新的需求出现时,您还可以添加

突出显示(例如颜色)等等。我建议你用你的应用程序工作,因为它现在使用RTB替换文本框,并且

不应该花太长时间,因为RTB和TextBox都继承了TextBoxBase。 br />


You beat me to the punch - an RTB is a good solution. You can set the RTB''s
DefaultFont property to an Arial font, and you can insert your tabular data
in a monospace font (like Courier New). You will also be able to add
highlighting (eg color) and so forth as new needs arise. I suggest you make
your app work as it does now with an RTB replacing the textbox, and that
should not take too long since RTB and TextBox both inherit TextBoxBase.


这篇关于格式化TextBox显示(非固定宽度字体)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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