Bagikan melalui


New Additions to Existing Features in Windows Forms

Together with some completely new features, this release of Visual Studio contains some additions to several classes that already existed. To aid you in finding these additions, the following tables link directly to the new members of these classes.

For a list of new Windows Forms features and controls in this version of Visual Studio, see Additions to Windows Forms for the .NET Framework 2.0.

The following members have been added to Windows Forms classes within the .NET Framework.

Application

Member

Description

EnterThreadModal event

Occurs when the application is about to enter a modal state.

LeaveThreadModal event

Occurs when the application is about to leave a modal state.

FilterMessage method

Runs any filters against a window message, and returns a copy of the modified message.

OpenForms property

Gets a collection of open forms owned by the application.

Restart method

Shuts down the application and starts a new instance immediately.

SetUnhandledExceptionMode method

Instructs the application how to respond to unhandled exceptions.

UseWaitCursor property

Gets or sets whether the wait cursor is used for all open forms of the application.

Clipboard

Beyond the members listed here, Clipboard now also supports a number of individual members for getting and setting specific data types, such as GetImage and GetAudioStream, among others. Refer to the class documentation for a full list.

Member

Description

Clear method

Removes all data from the Clipboard.

GetData method

Retrieves data from the Clipboard in the specified format.

SetData method

Adds data to the Clipboard in the specified format.

ContainsData method

Indicates whether there is data on the Clipboard that is in the specified format or can be converted to that format.

ComboBox

Member

Description

AutoCompleteCustomSource property

Gets or sets a custom StringCollection to use when the AutoCompleteSource property is set to CustomSource.

AutoCompleteMode property

Gets or sets an option that controls how automatic completion works for the ComboBox.

AutoCompleteSource property

Gets or sets a value specifying the source of complete strings used for automatic completion.

BackgroundImageLayout property

Gets or sets the background image layout as defined in the ImageLayout enumeration.

BeginUpdate method

Maintains performance when items are added to the ComboBox one at a time.

DropDown event

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

DropDownClosed event

Occurs when the drop-down portion of the ComboBox is no longer visible.

EndUpdate method

Resumes painting the ComboBox control after painting is suspended by the BeginUpdate method.

FlatStyle property

Gets or sets the flat style appearance of the button control.

OnDropDownClosed method

Raises the DropDownClosed event.

OnMouseEnter method

Raises the MouseEnter event.

OnMouseLeave method

Raises the MouseLeave event.

OnTextUpdate method

Raises the TextUpdate event.

TextUpdate event

Occurs when the control has formatted the text, but before the text is displayed.

Control

Member

Description

CheckForIllegalCrossThreadCalls property

Gets or sets a value indicating whether to catch calls on the wrong thread that access a control's Handle property.

DefaultCursor property

Gets or sets the default cursor for the control.

GetPreferredSize method

Retrieves the size of a rectangular area into which a control can be fitted.

IsKeyLocked property

Use this property to determine whether the CAPS LOCK, NUM LOCK, or SCROLL LOCK keys are on.

LayoutEngine property

Gets a cached instance of the control's layout engine.

Margin property

Gets or sets the space between controls.

MinimumSize property

Gets the size that is the lower limit that GetPreferredSize can specify.

MouseCaptureChanged event

Occurs when the control loses mouse capture.

MouseClick event

Occurs when the control is clicked by the mouse.

MouseDoubleClick event

Occurs when the control is double clicked by the mouse.

OnMouseClick method

Raises the MouseClick event.

OnMouseDoubleClick method

Raises the MouseDoubleClick event.

Padding property

Gets or sets padding within the control.

DataObject

Beyond the members listed here, DataObject now also supports a number of individual members for getting and setting specific data types, such as GetImage and GetAudioStream, among others. Refer to the class documentation for a full list.

Member

Description

GetData method

Retrieves data from the Clipboard in the specified format.

SetData method

Adds data to the Clipboard in the specified format.

Form

Member

Description

FormClosed event

Occurs after the form is closed.

FormClosing event

Occurs before the form is closed.

MainMenuStrip property

Gets or sets the primary menu container for the form.

RightToLeftLayout property

Gets or sets a value indicating whether right-to-left mirror placement is turned on.

RightToLeftLayoutChanged event

Raises the RightToLeftLayoutChanged event.

ShowWithoutActivation property

Gets a value indicating whether the window will be activated when it is shown.

Icon

Member

Description

ExtractAssociatedIcon method

This method is used to display the icon associated with a file.

Label

Member

Description

AutoEllipsis property

Gets or sets a value indicating whether the ellipsis character (...) appears at the right edge of the Label, denoting that the Label text extends beyond the specified length of the Label.

UseCompatibleTextRendering property

Gets or sets a value that specifies whether text rendering should be compatible with previous releases of Windows Forms.

ListBox

Member

Description

BeginUpdate method

Maintains performance when items are added to the ListBox one at a time.

EndUpdate method

Resumes painting the ListBox control after painting is suspended by the BeginUpdate method.

UseCustomTabOffsets property

Enables a ListBox to recognize and expand tab characters when drawing its strings using the CustomTabOffsets integer array.

ListView

Member

Description

FindItemWithText method

Finds the first ListViewItem that begins with the specified text value.

FindNearestItem method

Finds the next item, searching in the specified direction.

OwnerDraw property

Gets or sets a value indicating whether the ListView control is drawn by the operating system or by code that you provide.

VirtualMode property

Gets or sets a value indicating whether you have provided your own data-management operations for the ListView control.

MessageBox

Member

Description

Show method

This method now has overloads to specify Help pages and other Help-related functionality.

NotifyIcon

Member

Description

BalloonTipClicked event

Occurs when the balloon tip is clicked.

BalloonTipClosed event

Occurs when the balloon tip is closed by the user.

BalloonTipIcon property

Gets or sets the icon to display on the balloon tip associated with the NotifyIcon.

BalloonTipShown event

Occurs when the balloon tip is displayed on the screen.

BalloonTipText property

Gets or sets the text to display on the balloon tip associated with the NotifyIcon.

BalloonTipTitle property

Gets or sets the title of the balloon tip displayed on the NotifyIcon.

ShowBalloonTip method

Displays a balloon tip in the taskbar for the specified time period.

ShowBalloonTip method

Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period.

PictureBox

Member

Description

LoadAsync method

Loads the image asynchronously.

LoadCompleted event

Occurs when the asynchronous image-load operation is completed, been cancelled or raised an exception.

LoadProgressChanged event

Occurs when the progress of an asynchronous image-loading operation has changed.

RichTextBox

Member

Description

GetCharIndexFromPosition method

Retrieves the index of the character nearest to the specified location.

GetLineFromCharIndex method

Retrieves the line number from the specified character position within the text of the control.

GetPositionFromCharIndex method

Retrieves the location within the control at the specified character index.

Rtf property

Gets or sets the text of the RichTextBox control, including all Rich Text Format (RTF) codes.

SelectionBackColor property

Gets or sets the color of text when the text is selected in a RichTextBox control.

Screen

Member

Description

BitsPerPixel property

Gets the number of bits of memory, associated with one pixel of data.

ScrollableControl

Member

Description

Scroll event

This event is raised when the area of a form (or other class that inherits from ScrollableControl) is scrolled.

SystemInformation

Member

Description

ActiveWindowTrackingDelay property

Gets the active window tracking delay.

BorderMultiplierFactor property

Gets the border multiplier factor that is used when determining the thickness of a window's sizing border.

CaptionButtonSize property

Gets the standard size, in pixels, of a button in a window's title bar.

CaretWidth property

Gets the width, in pixels, of the caret in edit controls.

FontSmoothingContrast property

Gets the font smoothing contrast value used in ClearType smoothing.

FontSmoothingType property

Gets the current type of font smoothing.

HorizontalFocusThickness property

Gets the thickness of the left and right edges of the system focus rectangle, in pixels.

HorizontalResizeBorderThickness property

Gets the thickness of the left and right edges of the sizing border around the perimeter of a window being resized, in pixels.

IconHorizontalSpacing property

Gets the width, in pixels, of an icon arrangement cell in large icon view.

IconVerticalSpacing property

Gets the height, in pixels, of an icon arrangement cell in large icon view.

IsActiveWindowTrackingEnabled property

Gets a value indicating whether active window tracking is enabled.

IsComboBoxAnimationEnabled property

Gets a value indicating whether the slide-open effect for combo boxes is enabled.

IsDropShadowEnabled property

Gets a value indicating whether the system's drop shadow effect is enabled.

IsFlatMenuEnabled property

Gets a value indicating whether native User menus have a flat menu appearance.

IsFontSmoothingEnabled property

Gets a value indicating whether the font smoothing feature is enabled.

IsHotTrackingEnabled property

Gets a value indicating whether hot tracking of user-interface elements, such as menu names on menu bars, is enabled.

IsIconTitleWrappingEnabled property

Gets a value indicating whether icon title wrapping is enabled.

IsKeyboardPreferred property

Gets a value indicating whether the user relies on the keyboard instead of the mouse, and prefers applications to display keyboard interfaces that would otherwise be hidden.

IsListBoxSmoothScrollingEnabled property

Gets a value indicating whether the smooth-scrolling effect for list boxes is enabled.

IsMenuAnimationEnabled property

Gets a value indicating whether menu fade or slide animation features are enabled.

IsMenuFadeEnabled property

Gets a value indicating whether menu fade animation is enabled.

IsMinimizeRestoreAnimationEnabled property

Gets a value indicating whether window minimize and restore animation is enabled.

IsSelectionFadeEnabled property

Gets a value indicating whether the selection fade effect is enabled.

IsSnapToDefaultEnabled property

Gets a value indicating whether the snap-to-default-button feature is enabled.

IsTitleBarGradientEnabled property

Gets a value indicating whether the gradient effect for window title bars is enabled.

IsToolTipAnimationEnabled property

Gets a value indicating whether ToolTip animation is enabled.

KeyboardDelay property

Gets the keyboard repeat-delay setting.

KeyboardSpeed property

Gets the keyboard repeat-speed setting.

MenuBarButtonSize property

Gets the default width, in pixels, for menu-bar buttons and the height, in pixels, of a menu bar.

MenuShowDelay property

Gets the time, in milliseconds, that the system waits before displaying a cascaded shortcut menu when the mouse cursor is over a submenu item.

MouseHoverTime property

Gets the time, in milliseconds, that the mouse pointer has to stay in the hover rectangle before a mouse hover message is generated.

MouseSpeed property

Gets the current mouse speed.

MouseWheelScrollDelta property

Gets the amount of the delta value of a single mouse wheel rotation increment.

PopupMenuAlignment property

Gets the side of pop-up menus that are aligned to the corresponding menu-bar item.

SizingBorderWidth property

Gets the width, in pixels, of the sizing border drawn around the perimeter of a window being resized.

SmallCaptionButtonSize property

Gets the width, in pixels, of small caption buttons, and the height, in pixels, of small captions.

VerticalFocusThickness property

Gets the thickness, in pixels, of the top and bottom edges of the system focus rectangle.

VerticalResizeBorderThickness property

Gets the thickness, in pixels, of the top and bottom edges of the sizing border around the perimeter of a window being resized.

SystemSounds

Member

Description

Asterisk property

Gets the sound associated with the Asterisk program event in the current Windows sound scheme.

Beep property

Gets the sound associated with the Beep program event in the current Windows sound scheme.

Exclamation property

Gets the sound associated with the Exclamation program event in the current Windows sound scheme.

Hand property

Gets the sound associated with the Hand program event in the current Windows sound scheme.

Question property

Gets the sound associated with the Question program event in the current Windows sound scheme.

TabControl

Member

Description

Deselected event

Occurs when a tab is deselected.

Deselecting event

Occurs before a tab is deselected, enabling a handler to cancel the tab change.

DeselectTab method

Makes the tab following the specified tab the current tab.

Selected event

Occurs when a tab is selected.

Selecting event

Occurs before a tab is selected, enabling a handler to cancel the tab change.

SelectTab method

Makes the specified tab the current tab.

TextBox

Member

Description

AutoCompleteCustomSource property

Gets or sets a custom StringCollection to use when the AutoCompleteSource property is set to CustomSource.

AutoCompleteMode property

Gets or sets an option that controls how automatic completion works for the TextBox.

AutoCompleteSource property

Gets or sets a value specifying the source of complete strings used for automatic completion.

UseSystemPasswordChar property

Gets or sets a value indicating whether the text in the TextBox control should appear as the default password character.

TextBoxBase

Member

Description

GetCharFromPosition method

Retrieves the character that is closest to the specified location within the control.

GetCharIndexFromPosition method

Retrieves the index of the character nearest to the specified location.

GetFirstCharIndexOfCurrentLine method

Retrieves the index of the first character of the current line.

GetFirstCharIndexFromLine method

Retrieves the index of the first character of a given line.

GetLineFromCharIndex method

Retrieves the line number from the specified character position within the text of the control.

GetPositionFromCharIndex method

Retrieves the location within the control at the specified character index.

ScrollToCaret method

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

ShortcutsEnabled property

Gets or sets a value indicating whether the defined shortcuts are enabled.

Treeview

Member

Description

DrawMode property

Gets or sets the mode in which the control is drawn.

DrawNode event

Occurs when a TreeView is drawn and the DrawMode property is set to a TreeViewDrawMode value other than Normal.

HitTest method

Provides node information, given a point.

ShowNodeToolTips property

Gets or sets a value indicating ToolTips are shown when the mouse pointer hovers over a TreeNode.

TreeViewNodeSorter property

Gets or sets the implementation of IComparer to perform a custom sort of the TreeView nodes.