Disadvantages of The ListBox control

Source: Internet
Author: User

In winformProgramThe ListBox control is also a commonly used control. Let's take a look at the following C # program:

 
Using system; using system. text; using system. windows. forms; namespace skyiv. tester {sealed class listboxtester: FORM {ListBox; listboxtester () {text = "CLR" + environment. version. tostring (); ListBox = new ListBox (); ListBox. dock = dockstyle. fill; controls. add (ListBox);} protected override void onload (eventargs e) {ListBox. displaymember = "displayname"; ListBox. datasource = encoding. getencodings (); ListBox. selectedindex = ListBox. items. count-1; ListBox. enabled = false; base. onload (E);} static void main () {application. run (New listboxtester ());}}}

 

Compile and run in the. NET Framework 3.5 environment of Windows XP:

E: \ work>CSC/T: winexe listboxtester. CSMicrosoft (r) Visual C #3.5 compiler 3.5.21022.8 for Microsoft (R). Net Framework 2008 is copyrighted (c) Microsoft Corporation. All rights reserved. E: \ work>Listboxtester.exeE: \ work>

 

Compile and run the program in the. NET Framework 4 environment of Windows XP:

E: \ work>CSC/T: winexe listboxtester. CSMicrosoft (r) Visual C #2010 compiler 4.0.30319.1 copyright (c) Microsoft Corporation. All rights reserved. E: \ work>Listboxtester.exeE: \ work>

 

Compile and run in the mono 2.6.7 environment of ubuntu 10.10:

Ben@ben-m4000t :~ /Work $GMCs listboxtester. CS-R: system. Windows. Forms. dllBen@ben-m4000t :~ /Work $./Listboxtester.exeBen@ben-m4000t :~ /Work $

 

Compile and run in the mono 2.8.1 environment of ubuntu 10.10:

Ben@ben-m4000t :~ /Work $/Opt/mono-2.8.1/bin/DMCS listboxtester. CS-R: system. Windows. Forms. dllBen@ben-m4000t :~ /Work $/Opt/mono-2.8.1/bin/MONO listboxtester.exeBen@ben-m4000t :~ /Work $

 

Note that the title bar of this program displays the CLR version number. In the Ubuntu 10.10 operating system, by default, the close button and the max button of the program form are displayed on the left of the title bar rather than on the right, this is also a feature of the Ubuntu operating system. Also, in the mono runtime environment, if the value of the enabled attribute of The ListBox control is false, the scroll bar handle on the right will not be displayed. It may be that mono thinks that in this case, the handle cannot be dragged, and it is simply canceled. In fact, this handle can also be used to indicate the position of the currently displayed content in the entire list, or better display.

In the above four sets of runtime environments, the first figure shows the situation when the program started running. The second figure shows how to increase the height of the program form. You can see that the currently selected list items are displayed. The third figure shows how to reduce the height of the program form to the first running state of the program. The selected list items are not displayed. In my opinion, this is an area to be improved and the currently selected list items should be displayed. Because the ListBox control is disabled, you cannot drag the scroll bar on the right to view what the selected project is. Only the height of the form can be increased. In particular, if you maximize the form once and then restore the form, you have to maximize the form again if you want to view the selected project.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.