100 likes | 236 Views
Group Boxes and Panels. Arrange components on a GUI Buttons and etc. can be placed inside a group box or panel. All these buttons move together when the group box or a panel is moved
E N D
Group Boxes and Panels • Arrange components on a GUI • Buttons and etc. can be placed inside a group box or panel. All these buttons move together when the group box or a panel is moved • The main difference between GroupBox and Panel is that group boxes can display a caption and panel can have scrollbars
GroupBox properties • Controls: controls that the group box contains • Text: text displayed on the top portion of the group box (its caption) Panel properties • AutoScroll • BorderStyle • Controls
ListBoxes • The list box control allows the user to view and select from multiple items in a list. • CheckedListBox control extends a list box by including checkboxes next to each item in the list.
Common properties • Items – list of items within the lsit • MultiColumn • SelectedIndex – return currently selected item • SelectedIndices • SelectedItem • SelectedItems • Sorted – indicates whether items appear in order. True causes alphabetization; default is false
Common method • GetSelected – takes an index and returns true if the corresponding item is selected. • Common event • SelectedIndexChanged – generated when selected index changes
To add items • To add items to the list box or the checkedList box, invoke method Add • For example mylistbox->Add(“My item”); • To add multiple objects, use Add multiple times or use method AddRange to add an array of objects
checkedListBoxes • Multiple items can be selected • Common properties • CheckedItems • CheckedIndices • CheckOnClick – if true, items can be checked and unchecked with a single mouse click. If false, double click • SelectionMode-One
Common method • GetItemChecked – takes an index, and returns true if corresponding item is checked • Common event • itemCheck – generated when an item is checked or unchecked • ItemCheckEventArgs properties • CurrentValue – indicates whether current item is checked or unchecked
ComboBoxes • Combines TextBox features with a dropdown list • It usually appears as a textbox or click the down arrow to its right. • By default, the user can enter text into the textbox or click the down arrow to display a list of predefined items
Common properties • DropDownStyle • Simple – text editable; list visible • DropDown- text editable; click to see list • DropDownList- text not editable; click to see the list • Items –collection of items • MaxDropDownItems – maximum items • SelectedIndex • SelectedItem • Sorted Common Event- SelectedIndexChanged