简体   繁体   English

将列表框合并为富文本框?

[英]Combining list boxes into rich text boxes?

another homework assignment here thats kind of unclear on the requirements. 这里的另一项作业是对要求的不清楚。 It is a forms program that assigns people to seats on an airplane. 这是一个表格程序,可将人员分配到飞机上的座位。 The part that is losing me is that its telling me to display the passenger manifest in a list box, but then its telling me to display it in a list box. 使我迷失的部分是,它告诉我将旅客清单显示在列表框中,然后告诉我将其显示在列表框中。 Then it calls it a rich text box again. 然后,它再次将其称为富文本框。 The screenshots provided with the assignment only show one display box. 作业随附的屏幕截图仅显示一个显示框。 One of the events that is supposed to be included is a double click on an item in the manifest display. 应当包括的事件之一是双击清单显示中的项目。 When the flight is closed, it tallies up your first class and business class passengers and displays that info in the same display box. 航班关闭后,它将对头等舱和商务舱乘客进行分类,并在同一显示框中显示该信息。

So my question is, was list box somehow incorporated into the rich text box? 所以我的问题是,列表框是否以某种方式并入了富文本框? I thought maybe it was just overlayed, but later screenschots show the display box filled and scrolled down, as if it were all the same text box, rather than just a list box or rich text. 我以为也许只是覆盖了,但是后来的屏幕截图显示了显示框已填充并向下滚动,就好像它们都是相同的文本框,而不仅仅是列表框或富文本一样。 I'm confused. 我糊涂了。 Obviously, I'm not looking for anyone to do my work for me, but it doesn't appear this was covered in our material. 显然,我并不是在寻找任何人为我工作,但看来我们的资料中没有提到这一点。 Online class, so I don't get a lot of instructor feedback on stuff like this, unfortunately. 在线课程,很遗憾,我在此类事情上没有得到很多指导老师的反馈。 Can anyone offer to shed any light on this? 任何人都可以提出这个建议吗?

替代文字

Both controls support a double click event. 这两个控件都支持双击事件。 However, the big clue here is "double click on an item in a list box." 但是,这里的主要提示是“双击列表框中的项目”。 The control you want is a list box. 您想要的控件是一个列表框。

There's no restraint on the text in a list box, except that it can't really wrap (unless you're using WPF, in which case all bets are off). 列表框中的文本没有任何限制,除了它不能真正地换行(除非您使用的是WPF,在这种情况下所有选择均已关闭)。 In both snapshots, the text is narrow enough that there's no horizontal scrollbar. 在两个快照中,文本都足够窄,因此没有水平滚动条。

So the text you're seeing in the second example is just ListBox items that happen to look like they could have been rendered in a RichTextBox control using a Courier font. 因此,在第二个示例中看到的文本只是ListBox项,它们看起来好像可以使用Courier字体在RichTextBox控件中呈现。 Notice the vertical scrollbar in that snapshot. 注意该快照中的垂直滚动条。 It's because the ListBox has more items in it than the ListBox in the snapshot on the left. 这是因为ListBox中的项目比左侧快照中的ListBox多。

Short answer: The mention of RichTextBox is, likely, a typographical error. 简短答案:提到RichTextBox可能是印刷错误。 But you'd do well to ask your instructor to clarify. 但是,您最好请教您的老师澄清一下。

Based on the snapshot, I think you can achieve both of them using a ListBox, TextBox or a RichTextBox. 基于快照,我认为您可以使用ListBox,TextBox或RichTextBox来实现这两者。 You can use a ListBox then when you click on Close Flight you show a RichTextBox. 您可以使用列表框,然后在单击“关闭飞行”时显示一个RichTextBox。 Just place the 2 controls on top of each other and set the Visible property to true or false based on the button you click, eg Start a New Flight makes the ListBox visible and the RichTextBox hidden. 只需将2个控件置于彼此的顶部,然后根据您单击的按钮将Visible属性设置为true或false,例如,“开始新的飞行”使ListBox可见,而RichTextBox隐藏。
Does this answer you question? 这是否回答您的问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM