To Documents

Controls: Some Properties, Methods, and Events

 

    Part A: Properties, Methods, and Events Common to Many Controls

  1. Control Properties

  2. Control Methods

  3. Control Events

     

    Part B: Properties, Methods, and Events of Some Specific Controls

  4. Button (Derived from ButtonBase)

    • Property

        DialogResult   Gets or sets a value that is returned to the parent form when the button is clicked. Values are chosen from the DialogResult enumeration: Abort, Cancel, Ignore, No, None, Okay, Retry, Yes.

    • Method

        PerformClick   Generates a Click event for a Button object.

  5. ButtonBase (Derived from Control; base class for Button, CheckBox, and RadioButton)

    • Properties
        Image   The image that is displayed.

        ImageAlign   The alignment of an image that is displayed in the control. Values are chosen from the ContentAlignment enumeration: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight.

        ImageIndex   The index of the ImageList image to display.

        ImageList   The name of the ImageList to use for displaying an image.

  6. CheckBox (Derived from ButtonBase)

    • Properties

        Appearance   Determines the appearance of the radio button control. Values are chosen from the Appearance enumeration: Button, Normal.

        AutoCheck   Indicates whether the Checked value and the appearance of the control automatically change when the control is clicked (Boolean).

        Checked   Indicates whether the radio button is checked (Boolean).

        CheckState   Indicates the state of the radio button. Values are chosen from the CheckState enumeration: Checked, Indeterminate, Unchecked.

        ThreeState   Indicated whether the check box will allow three check states (Checked, Indeterminate, Unchecked) rather than two.

    • Events

        AppearanceChanged   Occurs when the Appearance property is changed.

        CheckedChanged   Occurs when the CheckedChanged property is changed.

        CheckStateChanged   Occurs when the CheckStateChanged property is changed.

  7. CheckedListBox (Derived from ListBox)

    • Properties

        CheckedIndices   The collection of indices of checked items.

        CheckedItems   The collection of checked items.

        CheckOnClick   Indicates whether the check box should be toggled when an item is selected (Boolean).

        ThreeDCheckBoxes   Indicates whether the check boxes display as Flat or Normal (Boolean).

    • Methods

        GetItemChecked   Indicates if the specified item is checked.

        GetItemCheckState   The check state of the current item. Values are chosen from the CheckState enumeration: Checked, Indeterminate, Unchecked.

        SetItemChecked   Set an item of a given index to checked.

        SetItemCheckState   Set the state of an item of a given index. Values are chosen from the CheckState enumeration: Checked, Indeterminate, Unchecked.

    • Event

        ItemCheck   Occurs when the CheckedState property of an item changes.

  8. ComboBox (Derived from ListControl)

    • Properties

        DrawMode   The drawing mode for the control. Values are chosen from the DrawMode enumeration: Normal, OwnerDrawFixed, OwnerDrawVariable.

        DropDownStyle   The style of the combo box. Values are chosen form the ComboBoxStyle enumeration: DropDown (user can edit the text in the text box; the The user must click the arrow button to display the list), DropDownList (user cannot edit the text in the text box; the The user must click the arrow button to display the list), Simple (user can edit the text in the text box; the list is always visible if the height of the combo box is large enough).

        DropDownWidth   The width of the of the drop-down portion of a combo box.

        DroppedDown   Indicates if the combo box is displaying its drop-down portion.

        IntegralHeight   Indicates if the combobox should resize to avoid showing partial items (Boolean).

        ItemHeight   The height of an item in a user drawn combobox.

        Items   The collection of items stored in a combobox. Note: the items need not be String objects.

        MaxDropDownItems   The maximum number of items to be shown in the drop-down listbox.

        MaxLength   The maximum number of characters allowed in the editable textbox.

        PreferredHeight   The combined height of all items.

        SelectedIndex   The zero-based index of the currently selected item. The value -1 is returned if there are no selected items. If the SelectionMode is set to SelectionMode.MultiSimple or SelectionMode.MultiExtended any of the selected indices may be returned.

        SelectedIndex   The zero-based index of the currently selected item. The value -1 is returned if there are no item selected.

        SelectedItem   A reference to the selected item. If no item is selected, Nothing is returned.

        SelectedText   A string that represents the currently selected text in the editable textbox. If DropDownStyle is set to ComboBoxStyle.DropDownList, the return is an empty string.

        SelectionLength   The number of characters selected in the editable textbox of the combobox.

        SelectionStart   The first character of the characters selected in the editable textbox of the combobox.

        Sorted   Indicates whether the items are maintained in sorted order (Boolean).

        Text   The current text in the editable text box of the combobox.

    • Methods

        BeginUpdate   Maintains performance while items are added to the ListBox one at a time by preventing the control from drawing until the EndUpdate method is called.

        EndUpdate   Resumes drawing the ListBox control after drawing is suspended by the BeginUpdate method.

        FindString   Finds the first item that starts with the specified string.

        FindStringExact   Finds the first item that exactly matches the specified string.

        GetItemHeight   The height of an item of a given index.

        Select   Select the specified text in the editable textbox.

        SelectAll   Select all the text in the editable textbox.

    • Events

        DrawItem   Occurs when a visual aspect of an owner-drawn combobox changes.

        DropDown   Occurs when the drop-down portion of a ComboBox is shown.

        DropDownStyleChanged   Occurs when the DropDownStyleProperty is changed.

        MeasureItem   Occurs when an owner-drawn combobox is created and the sizes of the list items are determined.

        SelectedIndexChanged   Occurs when the SelectedIndex property is changed.

        SelectionChangeCommitted   Occurs when the selected item has changed and that change is committed.

  9. GroupBox (Derived from Control class)

    • Properties

        FlatStyle   Indicates the flat style appearance of the group box control. Values are chosed from the FlatStyle enumeration: Flat, Popup, Standard, System.

  10. HScrollBar (Derived from ScrollBar)

    • All members are derived from ScrollBar.

  11. ImageList (Derived from Control)

    • Properties

        ColorDepth   The color depth of the image list. Values are chosen from the ColorDepth enumeration. Values are Depth16Bit, Depth24Bit, Depth32Bit, Depth4Bit, Depth8Bit.

        Images   The collection of images.

        ImageSize   The common size of the images. Default is 16x16; Maximum is 256x156.

        TransparentColor   The color to treat as transparent.

    • Method

        Draw   Draws the indicated image.

  12. Label (Derived from Control.)

    • Properties

        AutoSize   Indicates whether the control is automatically resized to display its entire contents (Boolean).

        BorderStyle   The border style for the control. Border styles are chosen from the BorderStyle enumeration: Fixed3D, FixedSingle, None.

        FlatStyle   The flat style appearance of the label control. Values are chosen from FlatStyle enumeration: Flat, Popup, Standard, System.

        Image   The image that is displayed.

        ImageAlign   The alignment of an image that is displayed in the control. Values are chosen from the ContentAlignment enumeration: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight.

        ImageIndex   The index of the ImageList image to display.

        ImageList   The name of the ImageList to use for displaying an image.

        PreferredHeight   The preferred height of the control (ReadOnly). The height of the control (in pixels), assuming a single line of text is displayed.

        PreferredWidth   The preferred width of the control (ReadOnly). The width of the control (in pixels), assuming a single line of text is displayed.

        TextAlign   The alignment of text in the label. Values are chosen from the ContentAlignment enumeration: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight.

  13. ListBox (Derived from ListControl)

    • Properties

        ColumnWidth   The width of columns in a multicolumn ListBox.

        DrawMode   The drawing mode for the control. Values are chosen from the DrawMode enumeration: Normal, OwnerDrawFixed, OwnerDrawVariable.

        HorizontalScrollBar   Indicates whether a horizontal scroll bar is displayed (Boolean).

        IntegralHeight   Indicates whether the listbox should resize to avoid showing partial items (Boolean).

        ItemHeight   The height of an item in a user drawn listbox.

        Items   The collection of items stored in a listbox. Note: the items need not be String objects.

        MultiColumn   Indicates whether the ListBox can have multiple columns (Boolean).

        PreferredHeight   The combined height of all items.

        ScrollAlwaysVisible   Indicates if the vertical scroll bar is shown at all times (Boolean).

        SelectedIndex   The zero-based index of the currently selected item. The value -1 is returned if there are no selected items. If the SelectionMode is set to SelectionMode.MultiSimple or SelectionMode.MultiExtended any of the selected indices may be returned.

        SelectedIndices   The collection of zero-based indices of the currently selected items. The count of the collection may be more than one if the SelectionMode is set to SelectionMode.MultiSimple or SelectionMode.MultiExtended.

        SelectedItem   A reference to the selected item. If no item is selected, Nothing is returned. If the SelectionMode is set to SelectionMode.MultiSimple or SelectionMode.MultiExtended any of the selected items may be returned.

        SelectedItems     The collection of currently selected items. The count of the collection may be more than one if the SelectionMode is set to SelectionMode.MultiSimple or SelectionMode.MultiExtended.

        SelectionMode   The method in which items are selected. If set to SelectionMode.One, only one item can be selected. If set to SelectionMode.MultiSimple, a block of contiguous items can be selected (with the shift key down). If set to SelectionMode.MultiExtended multiple possibly noncontiguous items can be selected (with the control key down).

        Sorted   Indicates whether the items are maintained in sorted order (Boolean).

        Text   Contains the currently selected item r is r is a String object. If r is not a String object, r.ToString() is displayed.

        TopIndex   The index of the top visible item.

        UseTabStops   Indicates whether tab characters can be recognized and expanded (Boolean).

    • Methods

        BeginUpdate   Maintains performance while items are added to the ListBox one at a time by preventing the control from drawing until the EndUpdate method is called.

        ClearSelected   Unselects all the items.

        EndUpdate   Resumes drawing the ListBox control after drawing is suspended by the BeginUpdate method.

        FindString   Finds the first item that starts with the specified string.

        FindStringExact   Finds the first item that exactly matches the specified string.

        GetItemHeight   The height of an item of a given index.

        GetItemRectangle   The bounding rectangle for an item of a given index.

        GetSelected   Indicates whether a specified item is selected.

        IndexFromPoint   The zero-based index of the item at the specified coordinates.

        SetSelected   Selects or clears the selection for the specified item.

    • Events

        DrawItem   Occurs when a visual aspect of an owner-drawn ListBox changes.

        MeasureItem   Occurs when an owner-drawn ListBox is created and the sizes of the list items are determined.

        SelectedIndexChanged   Occurs when the SelectedIndex property is changed.

  14. ListControl (Derived from Control)

    • Properties

        DataSource   The data source for the ListControl.

        DisplayMember   A string that specifies the property of the data source whose contents you want to display.

        SelectedIndex   The zero-based index of the currently selected item.

        SelectedValue   The value of the member property specified by the ValueMember property.

        ValueMember   A string that specifies the property of the data source from which to draw the value.

  15. Panel (Derived from Control)

    • Properties

        BorderStyle   Indicates the border style for the control. Values are chosen from the BorderStyle enumeration: Fixed3D, FixedSingle, Normal.

  16. PictureBox (Derived from Control)

    • Properties

        BorderStyle   Indicates the border style for the control. Values are chosen from the BorderStyle enumeration: Fixed3D, FixedSingle, None.

        Image   The image that the PictureBox displays.

        SizeMode   Indicates how the image is displayed. Values are chosen from the PictureBoxSizeMode enumeration: AutoSize, CenterImage, Normal, StretchImage.

    • Event

        SizeModeChanged   Occurs when the SizeMode property is changed.

  17. RadioButton (Derived from ButtonBase)

    • Properties

        Appearance   Determines the appearance of the radio button control. Values are chosen from the Appearance enumeration: Button, Normal.

        AutoCheck   Indicates whether the Checked value and the appearance of the control automatically change when the control is clicked (Boolean).

        CheckAlign   The location of the check box portion of the radio button control. Values are chosen from the ContentAlignment enumeration: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight.

        Checked   Indicates whether the radio button is checked (Boolean).

    • Method

        PerformClick   Generates a Click event for a Button object.

    • Events

        AppearanceChanged   Occurs when the Appearance property is changed.

        CheckedChanged   Occurs when the Checked property is changed.

  18. ScrollBar (Derived from Control; Parent for HScrollBar and VScrollBar)

    • Properties

        LargeChange   The value to be added to or subtracted from the Value property when the track bar on either side of the scrollbar is clicked, or when the PageUp or PageDown keys are clicked.

        Maximum   Maximum value of the scrollbar.

        Minimum   Minimum value of the scrollbar.

        SmallChange   the value added to or subtracted from the Value property when the arrow keys are pressed, or when the ends of the scrollbar are clicked.

        Value   The numeric value of the scrollbar.

    • Events

        Scroll   Occurs when either a mouse or keyboard action moves the slider.

        ValueChanged   Occurs when the Value property of a scrollbar changes, either by movement of the slider or by manipulation in code.

  19. TextBox (Derived from TextBoxBase class)

    • Properties

        AcceptsReturn   Gets or sets a value indicating whether pressing ENTER in a multiline TextBox control creates a new line of text in the control or activates the default button for the form.

        CharacterCasing   Indicates whether the TextBox control modifies the case of characters as they are typed. Values are chosen from the CharacterCasing enumeration: Lower, Normal, Upper.

        PasswordChar   The character used to mask characters of a password in a single-line TextBox control

        ScrollBars   Determines which scroll bars should appear in a multiline TextBox control. Values are chosen from the TextBox.ScrollBars enumeration: Both, Left, None, Right.

        TextAlign   The alignment of text in the label. Values are chosen from the ContentAlignment enumeration: BottomCenter, BottomLeft, BottomRight, MiddleCenter, MiddleLeft, MiddleRight, TopCenter, TopLeft, TopRight.

    • Event

        TextAlignChanged   Occurs when the TextAlign property is changed.

        MultiLineChanged   Occurs when the MultiLine property is changed.

        ReadOnlyChanged   Occurs when the ReadOnly property is changed.

  20. TextBoxBase (Derived from Control; Parent for TextBox and RichTextBox.)

    • Properties

        AcceptsTab   Indicates whether pressing the TAB key in a multiline text box control types a TAB character in the control instead of moving the focus to the next control in the tab order.

        AutoSize   Indicates whether the control is automatically resized to display its entire contents (Boolean).

        BorderStyle   The border style for the control. Border styles are chosen from the BorderStyle enumeration: Fixed3D, FixedSingle, None.

        CanUndo   Indicates whether the user can undo the previous operation in a text box control (Boolean).

        HideSelection   Indicates whether the selected text in the text box control remains highlighted when the control loses focus.

        Lines   The lines of text in a text box control as an array of strings.

        MaxLength   The maximum number of characters the user can type or paste into the text box control.

        Modified   Indicates that the text box control has been modified by the user since the control was created or its contents were last set in code (Boolean).

        MultiLine   Indicates whether this is a multiline text box control (Boolean).

        PreferredHeight   The preferred height of the control (ReadOnly). The height of the control (in pixels), assuming a single line of text is displayed.

        ReadOnly   Indicates whether the user is allowed to type to change the text (False) or if it is read only (True).

        SelectedText   The currently selected text in the control.

        SelectionLength   The length of the selected text.

        SelectionStart   The index of the position where the selected text starts.

        TextLength   The length of the selected text.

        WordWrap   Indicates whether a multiline text box control automatically wraps words to the beginning of the next line when necessary.

    • Methods

        AppendText   Appends text to the current text of text box.

        Clear   Sets the text in the textbox to the empty string.

        ClearUndo   Clears information about the most recent operation from the undo buffer of the text box.

        Copy   Copies the current selection in the text box to the Clipboard.

        Cut   Moves the current selection in the text box to the Clipboard.

        Paste   Replaces the current selection in the text box with the contents of the Clipboard.

        ScrollToCarat   Scrolls the contents of the control to the current caret position.

        Select   Selects a range of text in the text box.

        SelectAll   Selects all text in the text box.

        Undo   Undoes the last edit operation in the text box.

    • Events

        AcceptsTabChanged   Occurs when the AcceptsTab property is changed.

        AutoSizeChanged   Occurs when the AutoSize property is changed.

        BorderStyleChanged   Occurs when the BorderStyle property is changed.

        HideSelectionChanged   Occurs when the HideSelection property is changed.

        ModifiedChanged   Occurs when the Modified property is changed.

        ReadOnlyChanged   Occurs when the ReadOnly property is changed.

  21. TrackBar (Derived from Control)

    • Properties

        AutoSize   Indicates whether the height or width of the track bar is being automatically sized (Boolean).

        LargeChange   The value to be added to or subtracted from the Value property when the track bar on either side of the slider is clicked, or when the PageUp or PageDown keys are clicked.

        Maximum   Maximum value of the slider.

        Minimum   Minimum value of the slider.

        SmallChange   the value added to or subtracted from the Value property when the arrow keys are pressed.

        Orientation   Determines the orientation of the track bar. Values are chosen from the Orientation enumeration: Horizontal, Vertical.

        TickFrequency   The frequency of the tick marks.

        TickStyle   Indicates how to display the tick marks on the track bar. Values are chosen from the TickStyle enumeration: Both, BottomRight, None, TopLeft.

        Value   The numeric value of the track bar.

    • Method

        SetRange   Sets the Minimum and Maximum properties of the track bar.

    • Events

        Scroll   Occurs when either a mouse or keyboard action moves the slider.

        ValueChanged   Occurs when the Value property of a track bar changes, either by movement of the slider or by manipulation in code.

  22. VScrollBar (Derived from ScrollBar)

    • All members are derived from ScrollBar.