Professional Documents
Culture Documents
Slide 02 Winforms 2005
Slide 02 Winforms 2005
Slide 1 of 21
Session 2
Grouping and Graphic Controls
Trnh by : V Ngc t Email : vongocdatit@gmail.com in thoi : 0934.969.680
9/12/2013
Slide 2 of 26
Module Introduction
Windows Forms contains various controls, which you can use to create a graphical user interface (GUI) of an application. One such category is values setting controls, which allow you to select the required values from a list of values. Another category is of the grouping controls, which enable you to organize the related controls in a group. Lastly, the other category is of the graphic controls, which are used to display images on the Windows Forms.
9/12/2013
Slide 3 of 38
9/12/2013
Slide 4 of 38
"RadioButton" Control
The RadioButton control allows the user to select a single value from the given set of values.
9/12/2013
Property
Appearance AutoCheck
Slide 5 of 38
Description
Specifies or retrieves a value indicating the appearance of the control. The radio button can appear as a normal button or as a Windows button. Specifies or retrieves a value indicating whether the value of the Checked property and the appearance of the control change automatically when the control is clicked.
Checked
Image
Method
PerformClick Select Event CheckedChanged Click
Description
Generates a Click event for the control, imitating the click action by the user. Activates the control. Description Occurs when there is a change in the value of the Checked property. Occurs when the radio button control is clicked.
9/12/2013
Slide 6 of 38
9/12/2013
Slide 7 of 38
"CheckBox" Control
The CheckBox control allows you to accept multiple values from a list of values. This control ca be used when you want the user to choose one or more options.
9/12/2013
Property Checked CheckState Description
Slide 8 of 38
Specifies or retrieves a value indicating whether the control is checked. Specifies or retrieves the state of the control. The control has three states Checked, Indeterminate, and Unchecked. Specifies or retrieves a value indicating whether the control will allow three checkstates instead of two. Description Activates the control. Exhibits the control to the user. Description Occurs when the Checked property of the control is changed. Occurs when the CheckState property of the control is changed. Occurs when the control is clicked.
9/12/2013
Slide 9 of 38
9/12/2013
Slide 10 of 38
"CheckedListBox" Control
The CheckedListBox control is a control that allows you to accept multiple values from a list. This control is similar to a ListBox control, but it displays each value in a list along with a check box, which can be checked or unchecked.
9/12/2013
Property Description
Slide 11 of 38
Indicates the collection of checked indexes in the control.
Indicates the collection of checked items in the control. Specifies or retrieves a value whether an item in the control should be ticked when clicked.
CheckedIndices
CheckedItems CheckOnClick
Items
SelectedIndex SelectedItem
SelectedItems
Method ClearSelected GetItemChecked GetItemText Event ItemCheck SelectedlndexChanged SelectedValueChanged
9/12/2013
Slide 12 of 38
9/12/2013
Slide 13 of 38
Grouping Controls
Grouping controls are controls that function as a container for other controls. They allow you to logically organize controls in a group. The common types of grouping controls are: + Panel + GroupBox
9/12/2013
Slide 14 of 38
Graphic Controls
Graphic controls are the controls that are used to display graphics on a form. The types of graphic controls commonly used are: + PictureBox
+ ImageList
9/12/2013
Slide 15 of 38
"PictureBox" Control
A PictureBox control is used to display images on a form. You can display images as bitmap, GIF, JPEG,or icon file format using this control. A PictureBox control can be a container that can hold only a single image at a time.
9/12/2013
Property Description
Slide 16 of 38
Specifies or retrieves the image displayed by the control.
Specifies or retrieves the image to be displayed in the control, if an error has occurred while the image is being loaded or the loading process has been cancelled. Specifies how the image is displayed in the control. The values for this property are defined in the PictureBoxSizeMode enumeration, which are: AutoSize: Fits the control automatically to the size of the image. CenterImage: Displays the image in the center of the control, if the control's size is larger than the image. Strechlmage: Stretches the image to fit within the size of the control.
Image
ErrorImage SizeMode
Method
Load
Description
Loads a graphic in the control.
9/12/2013
Slide 17 of 38
"ImageList" Component
The ImageList component in Windows Forms is used to store a collection of images. The images stored in this component are displayed by other controls.
9/12/2013
Property ColorDepth Images Imagesize Name Method Draw Event RecreateHandle Description Specifies or retrieves the depth of the color of the image list. Retrieves the ImageList. ImageCollection, which is a collection of the image objects in the existing control. Specifies or retrieves the size of the images in the image list. Specifies or retrieves the name of the ImageList control. Description Draws the image. Description Occurs when the handle is recreated when the depth value of the image color changes.
Slide 18 of 38
9/12/2013
Slide 19 of 38
"SplitContainer" Control
The SplitContainer control allows you to create complex user interfaces by dividing the form into two resizable panels, either horizontally or vertically. The two panels are separated by a movable bar called as the splitter bar. The SplitContainer control is used when you want to display the hierarchical information in one panel and its sub-contents in another panel.
9/12/2013
Property BorderStyle FixedPanel IsSplitterFixed Panell Panel2 Orientation Method On SplitterMoved Event SplitterMoved Description
Slide 20 of 38
Specifies or retrieves the border style of the control using the BorderStyle enumeration. Specifies or retrieves which panel of the control will not change in size when the container is resized. Specifies or retrieves a value indicating whether the splitter present on the control is fixed or movable. Retrieves the left or top panel of the control depending on the vertical or horizontal orientation. Retrieves the right or bottom panel of the control depending on the vertical or horizontal orientation. Specifies or retrieves a value, which indicates the horizontal or vertical orientation of the panels. Description Triggers the SplitterMoved event. Description Occurs when the splitter is moved.
9/12/2013
Slide 21 of 38