From 25480ff84615b4437b42216a9af4a9a08c5fd023 Mon Sep 17 00:00:00 2001 From: David Coulter Date: Thu, 5 Nov 2020 11:04:06 -0800 Subject: [PATCH] Links: .NET Desktop - framework\winforms (#108) --- ...ecurity-considerations-in-windows-forms.md | 9 ++++-- .../application-settings-architecture.md | 12 ++++++-- .../application-settings-for-windows-forms.md | 4 ++- .../advanced/application-settings-overview.md | 7 +++-- ...-support-for-windows-forms-applications.md | 12 ++++++-- ...rop-by-displaying-a-windows-form-shadow.md | 4 ++- ...fects-of-modifying-base-form-appearance.md | 2 +- .../advanced/globalizing-windows-forms.md | 12 ++++---- ...e-an-elementhost-control-at-design-time.md | 2 +- .../how-to-create-application-settings.md | 4 ++- ...using-the-inheritance-picker-dialog-box.md | 4 +-- .../advanced/how-to-inherit-windows-forms.md | 8 ++--- ...a-multi-page-text-file-in-windows-forms.md | 5 +++- ...ing-each-windows-form-on-its-own-thread.md | 10 +++---- .../how-to-validate-application-settings.md | 2 +- ...etworking-in-windows-forms-applications.md | 5 +++- .../winforms/advanced/using-wpf-controls.md | 2 +- ...content-on-windows-forms-at-design-time.md | 2 +- ...content-on-windows-forms-at-design-time.md | 2 +- ...an-accessible-windows-based-application.md | 4 +-- ...content-on-windows-forms-at-design-time.md | 6 ++-- .../walkthrough-styling-wpf-content.md | 8 ++--- ...rms-and-unmanaged-applications-overview.md | 21 +++++++++----- ...indows-forms-and-unmanaged-applications.md | 8 +++-- .../windows-forms-visual-inheritance.md | 9 ++++-- ...on-to-a-treeview-or-listview-control-wf.md | 3 +- ...-wf-datagrid-control-using-the-designer.md | 2 +- .../attributes-in-windows-forms-controls.md | 6 +++- .../backgroundworker-component-overview.md | 9 +++--- .../controls/backgroundworker-component.md | 6 +++- ...data-to-the-datagrid-using-the-designer.md | 13 +++++---- ...bind-wf-controls-with-the-bindingsource.md | 3 +- ...rol-to-a-data-source-using-the-designer.md | 2 +- .../controls/button-control-windows-forms.md | 6 +++- ...ed-data-at-run-time-wf-datagrid-control.md | 3 +- ...ng-an-activex-control-on-a-windows-form.md | 8 ++--- .../controls/contextmenustrip-control.md | 6 +++- .../controls/control-type-recommendations.md | 4 +-- .../controls-to-use-on-windows-forms.md | 5 +++- ...-lookup-table-for-a-wf-combobox-listbox.md | 3 +- ...ter-detail-form-using-two-datagridviews.md | 8 +++-- ...-wf-datagrid-control-using-the-designer.md | 4 +-- ...ter-detail-form-using-two-datagridviews.md | 4 +-- ...ating-a-wf-control-design-time-features.md | 4 +-- ...-the-windows-forms-datagridview-control.md | 5 +++- ...ontrol-technology-summary-windows-forms.md | 10 ++++++- ...ng-a-property-in-windows-forms-controls.md | 7 +++-- ...ning-an-event-in-windows-forms-controls.md | 5 ++-- ...me-errors-in-the-windows-forms-designer.md | 8 ++--- ...oping-a-composite-windows-forms-control.md | 2 +- ...eveloping-custom-windows-forms-controls.md | 10 +++++-- ...g-windows-forms-controls-at-design-time.md | 6 ++-- .../events-in-windows-forms-controls.md | 5 ++-- ...umns-in-the-datagrid-using-the-designer.md | 3 +- ...occur-during-data-entry-in-the-datagrid.md | 8 +++-- ...occur-during-data-entry-in-the-datagrid.md | 4 +-- .../winforms/controls/handling-user-input.md | 7 +++-- ...-the-managed-html-document-object-model.md | 4 ++- ...-the-managed-html-document-object-model.md | 3 +- ...o-add-activex-controls-to-windows-forms.md | 6 ++-- .../how-to-add-controls-to-windows-forms.md | 5 ++-- ...thout-a-user-interface-to-windows-forms.md | 4 +-- ...ow-to-add-panels-to-a-statusbar-control.md | 3 +- ...om-a-collection-of-controls-at-run-time.md | 3 +- ...ly-attributes-in-windows-forms-controls.md | 9 +++++- ...-the-windows-forms-datagridview-control.md | 8 ++--- ...ows-forms-folderbrowserdialog-component.md | 2 +- ...a-resizable-windows-form-for-data-entry.md | 5 +++- ...ndows-forms-control-that-shows-progress.md | 4 ++- ...yout-that-responds-well-to-localization.md | 13 +++++---- ...-develop-a-simple-windows-forms-control.md | 8 ++--- ...-in-the-choose-toolbox-items-dialog-box.md | 4 +-- ...h-the-windows-forms-richtextbox-control.md | 2 +- ...-the-windows-forms-datagridview-control.md | 8 +++-- ...rms-datagrid-control-using-the-designer.md | 4 +-- ...a-form-that-uses-a-background-operation.md | 9 ++++-- ...it-from-existing-windows-forms-controls.md | 2 +- .../how-to-inherit-from-the-control-class.md | 2 +- ...w-to-inherit-from-the-usercontrol-class.md | 2 +- ...des-of-a-windows-forms-treeview-control.md | 3 +- ...o-the-windows-forms-richtextbox-control.md | 2 +- ...ad-safe-calls-to-windows-forms-controls.md | 4 +-- ...iles-using-the-openfiledialog-component.md | 4 +-- ...w-to-position-controls-on-windows-forms.md | 2 +- ...-provide-a-toolbox-bitmap-for-a-control.md | 6 ++-- ...how-to-resize-controls-on-windows-forms.md | 2 +- ...iles-using-the-savefiledialog-component.md | 2 +- ...-set-pictures-at-run-time-windows-forms.md | 3 +- ...-the-run-time-behavior-of-a-usercontrol.md | 3 +- ...a-background-thread-to-search-for-files.md | 6 ++-- ...-the-windows-forms-datagridview-control.md | 8 +++-- ...l-mode-jit-data-loading-in-the-datagrid.md | 8 ++++- .../framework/winforms/controls/index.md | 2 +- ...f-the-timer-component-interval-property.md | 4 ++- .../menustrip-control-windows-forms.md | 8 +++-- ...ethod-implementation-in-custom-controls.md | 4 ++- ...ataset-with-wf-bindingnavigator-control.md | 5 +++- .../controls/overriding-the-onpaint-method.md | 3 +- ...cument-component-overview-windows-forms.md | 2 +- ...ewdialog-control-overview-windows-forms.md | 2 +- .../properties-in-windows-forms-controls.md | 8 +++-- .../controls/property-changed-events.md | 5 ++-- ...ise-change-notifications--bindingsource.md | 5 +++- .../rendering-a-windows-forms-control.md | 7 ++++- ...t-set-intervals-with-wf-timer-component.md | 5 +++- ...esignerserializationvisibilityattribute.md | 6 ++-- ...et-data-with-wf-bindingsource-component.md | 7 +++-- .../winforms/controls/soundplayer-class.md | 6 +++- ...ontainer-control-overview-windows-forms.md | 3 +- .../controls/statusstrip-control-overview.md | 3 +- .../winforms/controls/statusstrip-control.md | 5 +++- .../tablelayoutpanel-control-windows-forms.md | 8 +++-- .../timer-component-overview-windows-forms.md | 4 ++- .../controls/toolstrip-technology-summary.md | 29 +++++++++++++------ .../controls/toolstripcontainer-control.md | 6 +++- .../toolstrippanel-control-overview.md | 3 +- ...hooting-control-and-component-authoring.md | 2 +- .../controls/varieties-of-custom-controls.md | 17 ++++++++--- ...st-in-time-data-loading-in-the-datagrid.md | 6 +++- ...-windows-forms-using-a-tablelayoutpanel.md | 6 ++-- ...ting-the-toolbox-with-custom-components.md | 12 ++++---- ...professionally-styled-toolstrip-control.md | 4 +-- ...ith-menu-merging-and-toolstrip-controls.md | 4 +-- ...a-form-that-uses-a-background-operation.md | 14 ++++----- ...indows-forms-control-with-visual-csharp.md | 2 +- ...-running-an-operation-in-the-background.md | 2 +- ...ting-status-bar-information-at-run-time.md | 3 +- ...-the-windows-forms-datagridview-control.md | 4 +-- .../winforms/controls/webbrowser-security.md | 5 ++-- ...reating-event-handlers-in-windows-forms.md | 6 ++-- ...data-sources-supported-by-windows-forms.md | 4 ++- .../winforms/events-overview-windows-forms.md | 8 +++-- .../high-dpi-support-in-windows-forms.md | 6 ++-- .../winforms/how-keyboard-input-works.md | 14 ++++++--- ...-to-change-the-borders-of-windows-forms.md | 5 ++-- ...d-control-and-format-the-displayed-data.md | 4 +-- ...-simple-bound-control-on-a-windows-form.md | 2 +- ...forms-application-from-the-command-line.md | 2 +- ...-handlers-at-run-time-for-windows-forms.md | 2 +- ...etermine-which-modifier-key-was-pressed.md | 3 +- .../winforms/how-to-resize-windows-forms.md | 2 +- ...e-file-and-data-access-in-windows-forms.md | 16 ++++++---- ...se-input-in-a-windows-forms-application.md | 5 +++- .../security-in-windows-forms-overview.md | 18 ++++++------ .../user-input-validation-in-windows-forms.md | 13 +++++++-- ...indows-forms-accessibility-improvements.md | 4 +-- .../winforms/windows-forms-security.md | 21 ++++++++------ 147 files changed, 557 insertions(+), 305 deletions(-) diff --git a/dotnet-desktop-guide/framework/winforms/additional-security-considerations-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/additional-security-considerations-in-windows-forms.md index c42cd8c..f6de6dd 100644 --- a/dotnet-desktop-guide/framework/winforms/additional-security-considerations-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/additional-security-considerations-in-windows-forms.md @@ -9,11 +9,13 @@ helpviewer_keywords: ms.assetid: 15abda8b-0527-47c7-aedb-77ab595f2bf1 --- # Additional Security Considerations in Windows Forms + .NET Framework security settings might cause your application to run differently in a partial trust environment than on your local computer. The .NET Framework restricts access to such critical local resources as the file system, network, and unmanaged APIs, among other things. The security settings affect the ability to call the Microsoft Windows API or other APIs that cannot be verified by the security system. Security also affects other aspects of your application, including file and data access, and printing. For more information about file and data access in a partial trust environment, see [More Secure File and Data Access in Windows Forms](more-secure-file-and-data-access-in-windows-forms.md). For more information about printing in a partial trust environment, see [More Secure Printing in Windows Forms](more-secure-printing-in-windows-forms.md). The following sections discuss how to work with the Clipboard, perform window manipulation, and call the Windows API from applications that are running in a partial trust environment. ## Clipboard Access + The class controls access to the Clipboard, and the associated enumeration value indicates the level of access. The following table shows the possible permission levels. |UIPermissionClipboard value|Description| @@ -22,9 +24,10 @@ ms.assetid: 15abda8b-0527-47c7-aedb-77ab595f2bf1 ||The Clipboard can be used with some restrictions. The ability to put data on the Clipboard (Copy or Cut command operations) is unrestricted. Intrinsic controls that accept paste, such as a text box, can accept Clipboard data, but user controls cannot programmatically read from the Clipboard.| ||The Clipboard cannot be used.| - By default, the Local Intranet zone receives access and the Internet zone receives access. This means that the application can copy data to the Clipboard, but the application cannot programmatically paste to or read from the Clipboard. These restrictions prevent programs without full trust from reading content copied to the Clipboard by another application. If your application requires full Clipboard access but you do not have the permissions, you will have to elevate the permissions for your application. For more information about elevating permissions, see [General Security Policy Administration](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)). + By default, the Local Intranet zone receives access and the Internet zone receives access. This means that the application can copy data to the Clipboard, but the application cannot programmatically paste to or read from the Clipboard. These restrictions prevent programs without full trust from reading content copied to the Clipboard by another application. If your application requires full Clipboard access but you do not have the permissions, you will have to elevate the permissions for your application. For more information about elevating permissions, see [General Security Policy Administration](/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)). ## Window Manipulation + The class also controls permission to perform window manipulation and other UI-related actions, and the associated enumeration value indicates the level of access. The following table shows the possible permission levels. By default, the Local Intranet zone receives access and the Internet zone receives access. This means that in the Internet zone, the application can perform most windowing and UI actions, but the window's appearance will be modified. The modified window displays a balloon notification when first run, contains modified title bar text, and requires a close button on the title bar. The balloon notification and the title bar identify to the user of the application that the application is running under partial trust. @@ -59,11 +62,13 @@ ms.assetid: 15abda8b-0527-47c7-aedb-77ab595f2bf1 ||- Calling the method.| ### Hosting Third-Party Controls + Another kind of window manipulation can occur if your forms host third-party controls. A third-party control is any custom that you have not developed and compiled yourself. Although the hosting scenario is hard to exploit, it is theoretically possible for a third-party control to expand its rendering surface to cover the entire area of your form. This control could then mimic a critical dialog box, and request information such as username/password combinations or bank account numbers from your users. To limit this potential risk, use third-party controls only from vendors you can trust. If you use third-party controls you have downloaded from an unverifiable source, we recommend that you review the source code for potential exploits. After you've verified that the source is non-malicious, you should compile the assembly yourself to ensure that the source matches the assembly. ## Windows API Calls + If your application design requires calling a function from the Windows API, you are accessing unmanaged code. In this case the code's actions to the window or operating system cannot be determined when you are working with Windows API calls or values. The class and the value of the enumeration control access to unmanaged code. An application can access unmanaged code only when it is granted the permission. By default, only applications that are running locally can call unmanaged code. Some Windows Forms members provide unmanaged access that requires the permission. The following table lists the members in the namespace that require the permission. For more information about the permissions that are required for a member, see the .NET Framework class library documentation. @@ -80,7 +85,7 @@ ms.assetid: 15abda8b-0527-47c7-aedb-77ab595f2bf1 If your application does not have permission to call unmanaged code, your application must request permission, or you must consider alternative ways of implementing features; in many cases, Windows Forms provides a managed alternative to Windows API functions. If no alternative means exist and the application must access unmanaged code, you will have to elevate the permissions for the application. - Permission to call unmanaged code allows an application to perform most anything. Therefore, permission to call unmanaged code should only be granted for applications that come from a trusted source. Alternatively, depending on the application, the piece of application functionality that makes the call to unmanaged code could be optional, or enabled in the full trust environment only. For more information about dangerous permissions, see [Dangerous Permissions and Policy Administration](https://docs.microsoft.com/dotnet/framework/misc/dangerous-permissions-and-policy-administration). For more information about elevating permissions, see [General Security Policy Administration](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)). + Permission to call unmanaged code allows an application to perform most anything. Therefore, permission to call unmanaged code should only be granted for applications that come from a trusted source. Alternatively, depending on the application, the piece of application functionality that makes the call to unmanaged code could be optional, or enabled in the full trust environment only. For more information about dangerous permissions, see [Dangerous Permissions and Policy Administration](/dotnet/framework/misc/dangerous-permissions-and-policy-administration). For more information about elevating permissions, see [General Security Policy Administration](/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)). ## See also diff --git a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-architecture.md b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-architecture.md index 19b2840..2fef817 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-architecture.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-architecture.md @@ -9,6 +9,7 @@ helpviewer_keywords: ms.assetid: c8eb2ad0-fac6-4ea2-9140-675a4a44d562 --- # Application Settings Architecture + This topic describes how the Application Settings architecture works, and explores advanced features of the architecture, such as grouped settings and settings keys. The application settings architecture supports defining strongly typed settings with either application or user scope, and persisting the settings between application sessions. The architecture provides a default persistence engine for saving settings to and loading them from the local file system. The architecture also defines interfaces for supplying a custom persistence engine. @@ -16,6 +17,7 @@ This topic describes how the Application Settings architecture works, and explor Interfaces are provided that enable custom components to persist their own settings when they are hosted in an application. By using settings keys, components can keep settings for multiple instances of the component separate. ## Defining Settings + The application settings architecture is used within both ASP.NET and Windows Forms, and it contains a number of base classes that are shared across both environments. The most important is , which provides access to settings through a collection, and provides low-level methods for loading and saving settings. Each environment implements its own class derived from to provide additional settings functionality for that environment. In a Windows Forms-based application, all application settings must be defined on a class derived from the class, which adds the following functionality to the base class: - Higher-level loading and saving operations @@ -36,6 +38,7 @@ This topic describes how the Application Settings architecture works, and explor [!code-vb[ApplicationSettings.Create#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/ApplicationSettings.Create/VB/MyAppSettings.vb#1)] ## Settings Persistence + The class does not itself persist or load settings; this job falls to the settings provider, a class that derives from . If a derived class of does not specify a settings provider through the , then the default provider, , is used. The configuration system that was originally released with the .NET Framework supports providing static application configuration data through either the local computer's machine.config file or within an `app.`exe.config file that you deploy with your application. The class expands this native support in the following ways: @@ -82,9 +85,10 @@ This topic describes how the Application Settings architecture works, and explor ``` - For a definition of the elements within the application settings section of a configuration file, see [Application Settings Schema](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/application-settings-schema). + For a definition of the elements within the application settings section of a configuration file, see [Application Settings Schema](/dotnet/framework/configure-apps/file-schema/application-settings-schema). ### Settings Bindings + Application settings uses the Windows Forms data binding architecture to provide two-way communication of settings updates between the settings object and components. If you use Visual Studio to create application settings and assign them to component properties, these bindings are generated automatically. You can only bind an application setting to a component that supports the interface. Also, the component must implement a change event for a specific bound property, or notify application settings that the property has changed through the interface. If the component does not implement and you are binding through Visual Studio, the bound properties will be set the first time, but will not update. If the component implements but does not support property change notifications, the binding will not update in the settings file when the property is changed. @@ -92,6 +96,7 @@ This topic describes how the Application Settings architecture works, and explor Some Windows Forms components, such as , do not support settings bindings. ### Settings Serialization + When must save settings to disk, it performs the following actions: 1. Uses reflection to examine all of the properties defined on your derived class, finding those that are applied with either or . @@ -103,6 +108,7 @@ This topic describes how the Application Settings architecture works, and explor If you implement your own settings class, you can use the to mark a setting for either binary or custom serialization using the enumeration. For more information on creating your own settings class in code, see [How to: Create Application Settings](how-to-create-application-settings.md). ### Settings File Locations + The location of the `app`.exe.config and *user*.config files will differ based on how the application is installed. For a Windows Forms-based application copied onto the local computer, `app`.exe.config will reside in the same directory as the base directory of the application's main executable file, and *user*.config will reside in the location specified by the property. For an application installed by means of ClickOnce, both of these files will reside in the ClickOnce Data Directory underneath %InstallRoot%\Documents and Settings\\*username*\Local Settings. The storage location of these files is slightly different if a user has enabled roaming profiles, which enables a user to define different Windows and application settings when they are using other computers within a domain. In that case, both ClickOnce applications and non-ClickOnce applications will have their `app`.exe.config and *user*.config files stored under %InstallRoot%\Documents and Settings\\*username*\Application Data. @@ -110,11 +116,13 @@ This topic describes how the Application Settings architecture works, and explor For more information about how the Application Settings feature works with the new deployment technology, see [ClickOnce and Application Settings](/visualstudio/deployment/clickonce-and-application-settings). For more information about the ClickOnce Data Directory, see [Accessing Local and Remote Data in ClickOnce Applications](/visualstudio/deployment/accessing-local-and-remote-data-in-clickonce-applications). ## Application Settings and Security + Application settings are designed to work in partial trust, a restricted environment that is the default for Windows Forms applications hosted over the Internet or an intranet. No special permissions beyond partial trust are needed to use application settings with the default settings provider. When application settings are used in a ClickOnce application, the `user`.config file is stored in the ClickOnce data directory. The size of the application's `user`.config file cannot exceed the data directory quota set by ClickOnce. For more information, see [ClickOnce and Application Settings](/visualstudio/deployment/clickonce-and-application-settings). ## Custom Settings Providers + In the Application Settings architecture, there is a loose coupling between the applications settings wrapper class, derived from , and the associated settings provider or providers, derived from . This association is defined only by the applied to the wrapper class or its individual properties. If a settings provider is not explicitly specified, the default provider, , is used. As a result, this architecture supports creating and using custom settings providers. For example, suppose that you want to develop and use `SqlSettingsProvider`, a provider that will store all settings data in a Microsoft SQL Server database. Your -derived class would receive this information in its `Initialize` method as a parameter of type . You would then implement the method to retrieve your settings from the data store, and to save them. Your provider can use the supplied to to determine the property's name, type, and scope, as well as any other settings attributes defined for that property. @@ -148,4 +156,4 @@ This topic describes how the Application Settings architecture works, and explor - [Application Settings Overview](application-settings-overview.md) - [Application Settings for Custom Controls](application-settings-for-custom-controls.md) - [ClickOnce and Application Settings](/visualstudio/deployment/clickonce-and-application-settings) -- [Application Settings Schema](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/application-settings-schema) +- [Application Settings Schema](/dotnet/framework/configure-apps/file-schema/application-settings-schema) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-for-windows-forms.md b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-for-windows-forms.md index a806db7..592b35e 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-for-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-for-windows-forms.md @@ -9,9 +9,11 @@ helpviewer_keywords: ms.assetid: 64090a34-8556-4904-8ea0-20efe9f8c886 --- # Application Settings for Windows Forms + The Applications Settings feature of Windows Forms makes it easy to create, store, and maintain custom application and user preferences on the client. With Application Settings, you can store not only application data such as database connection strings, but also user-specific data, such as toolbar positions and most-recently used lists. ## In This Section + [Application Settings Overview](application-settings-overview.md) Discusses how to create and store settings data on behalf of your application and your users. @@ -32,7 +34,7 @@ The Applications Settings feature of Windows Forms makes it easy to create, stor ## Related topics -[Windows Forms Configuration Section](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/winforms/index) +[Windows Forms Configuration Section](/dotnet/framework/configure-apps/file-schema/winforms/index) Documents the settings to enable High DPI support in Windows Forms Application starting with the .NET Framework 4.7. ## See also diff --git a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-overview.md b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-overview.md index c1d2378..c17df03 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/application-settings-overview.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/application-settings-overview.md @@ -18,7 +18,8 @@ This article discusses how to create and store settings data on behalf of your a Application settings enables developers to save state in their application using very little custom code, and is a replacement for dynamic properties in previous versions of the .NET Framework. Application settings contains many improvements over dynamic properties, which are read-only, late-bound, and require more custom programming. The dynamic property classes have been retained in .NET Framework 2.0, but they are just shell classes that thinly wrap the application settings classes. -## What Are Application Settings? +## What Are Application Settings + Your Windows Forms applications will often require data that's critical to running the application, but which you don't want to include directly in the application's code. If your application uses a Web Service or a database server, you may want to store this information in a separate file, so that you can change it in the future without recompiling. Similarly, your applications may require storing data that is specific to the current user. Most applications, for example, have user preferences that customize the application's appearance and behavior. Application settings addresses both needs by providing an easy way to store both application-scoped and user-scoped settings on the client computer. Using Visual Studio or a code editor, you define a setting for a given property by specifying its name, data type, and scope (application or user). You can even place related settings into named groups for easier use and readability. Once defined, these settings are persisted and read back into memory automatically at run time. A pluggable architecture enables the persistence mechanism to be changed, but by default, the local file system is used. @@ -30,13 +31,15 @@ This article discusses how to create and store settings data on behalf of your a Custom controls can also save their own settings by implementing the interface, which exposes the method. The Windows Forms control implements this interface to save the position of toolbars and toolbar items between application sessions. For more information about custom controls and application settings, see [Application Settings for Custom Controls](application-settings-for-custom-controls.md). ## Limitations of Application Settings + You cannot use application settings in an unmanaged application that hosts the .NET Framework. Settings will not work in such environments as Visual Studio add-ins, C++ for Microsoft Office, control hosting in Internet Explorer, or Microsoft Outlook add-ins and projects. You currently cannot bind to some properties in Windows Forms. The most notable example is the property, as binding to this property would cause unpredictable behavior at run time. You can usually work around these issues by saving and loading these settings programmatically. - Application settings has no built-in facility for encrypting information automatically. You should never store security-related information, such as database passwords, in clear text. If you want to store such sensitive information, you as the application developer are responsible for making sure it is secure. If you want to store connection strings, we recommend that you use Windows Integrated Security and not resort to hard-coding passwords into the URL. For more information, see [Code Access Security and ADO.NET](https://docs.microsoft.com/dotnet/framework/data/adonet/code-access-security). + Application settings has no built-in facility for encrypting information automatically. You should never store security-related information, such as database passwords, in clear text. If you want to store such sensitive information, you as the application developer are responsible for making sure it is secure. If you want to store connection strings, we recommend that you use Windows Integrated Security and not resort to hard-coding passwords into the URL. For more information, see [Code Access Security and ADO.NET](/dotnet/framework/data/adonet/code-access-security). ## Getting Started with Application Settings + If you use Visual Studio, you can define settings within the Windows Forms Designer using the **(ApplicationSettings)** property in the **Properties** window. When you define settings this way, Visual Studio automatically creates a custom managed wrapper class that associates each setting with a class property. Visual Studio also takes care of binding the setting to a property on a form or control so that the control's settings are restored automatically when its form is displayed, and saved automatically when the form is closed. If you want more detailed control over your settings, you can define your own custom applications settings wrapper class. This is accomplished by deriving a class from , adding a property that corresponds to each setting, and applying special attributes to these properties. For details about creating wrapper classes, see [Application Settings Architecture](application-settings-architecture.md). diff --git a/dotnet-desktop-guide/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md b/dotnet-desktop-guide/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md index 7f23325..7cf8c3e 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md @@ -9,13 +9,16 @@ helpviewer_keywords: - "Windows Forms, bi-directional support" --- # Bi-Directional Support for Windows Forms Applications + You can use Visual Studio to create Windows-based applications that support bi-directional (right-to-left) languages such as Arabic and Hebrew. This includes standard forms, dialog boxes, MDI forms, and all the controls you can work with in these forms—that is, all the objects in the namespace. ## Culture Support + Culture and UI culture settings determine how an application works with dates, times, currency, and other information. Support for culture and UI culture is the same for bi-directional languages as it is for any other languages. For more information, see [Culture-specific classes for global Windows forms and web forms](/visualstudio/ide/globalizing-and-localizing-applications). ## RightToLeft and RightToLeftLayout Properties - The base class, from which forms derive, includes a property that you can set to change the reading order of a form and its controls. If you set the form's property, by default controls on the form inherit this setting. However, you can also set the property individually on most controls. Also see [How to: Display Right-to-Left Text in Windows Forms for Globalization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7d3337xw(v=vs.100)). + + The base class, from which forms derive, includes a property that you can set to change the reading order of a form and its controls. If you set the form's property, by default controls on the form inherit this setting. However, you can also set the property individually on most controls. Also see [How to: Display Right-to-Left Text in Windows Forms for Globalization](/previous-versions/visualstudio/visual-studio-2010/7d3337xw(v=vs.100)). The effect of the property can differ from one control to another. In some controls the property only sets the reading order, as in the , and controls. In other controls, the property changes both reading order and layout. This includes the , and controls. Other controls require that the property be applied to mirror its layout from right to left. The following table provides details on how the and properties affect individual Windows Forms controls. @@ -71,22 +74,27 @@ You can use Visual Studio to create Windows-based applications that support bi-d ||Displayed on the left side instead of right side of scrollable controls|No effect|No| ## Encoding + Windows Forms support Unicode, so you can include any character set when you create your bi-directional applications. However, not all Windows Forms controls support Unicode on all platforms. ## GDI+ + You can use GDI+ to draw text with right-to-left reading order. The method, which is used to draw text, supports a `StringFormat` parameter that you can set to the member of the enumeration in order to reverse the point of origin for the text. ## Common Dialog Boxes + System tools such as the File Open dialog box are under the control of Windows. They inherit language elements from the operating system. If you are using a version of Windows with the correct language settings, these dialog boxes will work correctly with bi-directional languages. Similarly, message boxes go through the operating system and support bi-directional text. The captions on message box buttons are based on the current language setting. By default, message boxes do not use right-to-left reading order, but you can specify a parameter to change the reading order when the message boxes are displayed. ## RightToLeft, Scrollbars, and ScrollableControl + There is currently a limitation in Windows Forms that prevents all classes derived from from acting properly when both is enabled and is set to . For example, let's say that you place a control such as —or a container class derived from (such as or )—on your form. If you set on the container to and then set the property on one or more of the controls inside of the container to , then no scrollbar ever appears. The class derived from acts as if were set to . Currently, the only workaround is to nest the inside another . For instance, if you need to work in this situation, you can place it inside of a control and set on the to . ## Mirroring + *Mirroring* refers to reversing the layout of UI elements so that they flow from right to left. In a mirrored Windows Form, for example, the Minimize, Maximize, and Close buttons appear left-most on the title bar, not right-most. Setting a form or control's property to `true` reverses the reading order of elements on a form, but this setting does not reverse the layout to be right-to-left— that is, it does not cause mirroring. For example, setting this property does not move the **Minimize**, **Maximize**, and **Close** buttons in the form's title bar to the left side of the form. Similarly, some controls, such as the control, require mirroring in order to change their display to be appropriate for Arabic or Hebrew. You can mirror these controls by settings the property. @@ -111,4 +119,4 @@ You can use Visual Studio to create Windows-based applications that support bi-d ## See also -- [Bidirectional Support for ASP.NET Web Applications](https://docs.microsoft.com/previous-versions/aspnet/6eedwbtt(v=vs.100)) +- [Bidirectional Support for ASP.NET Web Applications](/previous-versions/aspnet/6eedwbtt(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md b/dotnet-desktop-guide/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md index 527c995..19ce1f7 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md @@ -10,6 +10,7 @@ helpviewer_keywords: ms.assetid: 87aac8ad-3c04-43b3-9b0c-d0b00df9ee74 --- # How to: Support COM Interop by Displaying a Windows Form with the ShowDialog Method + You can resolve Component Object Model (COM) interoperability problems by displaying your Windows Form on a .NET Framework message loop, which is created by using the method. To make a form work correctly from a COM client application, you must run it on a Windows Forms message loop. To do this, use one of the following approaches: @@ -19,6 +20,7 @@ You can resolve Component Object Model (COM) interoperability problems by displa - Display each Windows Form on a separate thread. For more information, see [How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread](how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md). ## Procedure + Using the method can be the easiest way to display a form on a .NET Framework message loop because, of all the approaches, it requires the least code to implement. The method suspends the unmanaged application's message loop and displays the form as a dialog box. Because the host application's message loop has been suspended, the method creates a new .NET Framework message loop to process the form's messages. @@ -33,6 +35,6 @@ You can resolve Component Object Model (COM) interoperability problems by displa ## See also -- [Exposing .NET Framework Components to COM](https://docs.microsoft.com/dotnet/framework/interop/exposing-dotnet-components-to-co) +- [Exposing .NET Framework Components to COM](/dotnet/framework/interop/exposing-dotnet-components-to-co) - [How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread](how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md) - [Windows Forms and Unmanaged Applications](windows-forms-and-unmanaged-applications.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md b/dotnet-desktop-guide/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md index 227655b..d17ea54 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md @@ -19,6 +19,6 @@ Modifications made to the base form at run time have no affect on inherited form ## See also -- [base](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/base) +- [base](/dotnet/csharp/language-reference/keywords/base) - [How to: Inherit Windows Forms](how-to-inherit-windows-forms.md) - [Windows Forms Visual Inheritance](windows-forms-visual-inheritance.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/globalizing-windows-forms.md b/dotnet-desktop-guide/framework/winforms/advanced/globalizing-windows-forms.md index 95edbcb..5c005eb 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/globalizing-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/globalizing-windows-forms.md @@ -27,7 +27,7 @@ Introduces the `ImeMode` property, which is used to control the type of input a ## Related sections -- [Globalizing and localizing .NET applications](https://docs.microsoft.com/dotnet/standard/globalization-localization/index) +- [Globalizing and localizing .NET applications](/dotnet/standard/globalization-localization/index) - [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API Using the Designer](/visualstudio/deployment/walkthrough-downloading-satellite-assemblies-on-demand-with-the-clickonce-deployment-api-using-the-designer) @@ -35,12 +35,12 @@ Introduces the `ImeMode` property, which is used to control the type of input a - [Walkthrough: Downloading Satellite Assemblies on Demand with the ClickOnce Deployment API](/visualstudio/deployment/walkthrough-downloading-satellite-assemblies-on-demand-with-the-clickonce-deployment-api) -- [How to: Set the Culture and UI Culture for Windows Forms Globalization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/b28bx3bh(v=vs.100)) +- [How to: Set the Culture and UI Culture for Windows Forms Globalization](/previous-versions/visualstudio/visual-studio-2010/b28bx3bh(v=vs.100)) -- [How to: Create Mirrored Windows Forms and Controls](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/xwbz5ws0(v=vs.100)) +- [How to: Create Mirrored Windows Forms and Controls](/previous-versions/visualstudio/visual-studio-2010/xwbz5ws0(v=vs.100)) -- [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/1zkt8b33(v=vs.100)) +- [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](/previous-versions/visualstudio/visual-studio-2010/1zkt8b33(v=vs.100)) -- [Walkthrough: Localizing Windows Forms](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/y99d1cd3(v=vs.100)) +- [Walkthrough: Localizing Windows Forms](/previous-versions/visualstudio/visual-studio-2010/y99d1cd3(v=vs.100)) -- [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)) +- [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md b/dotnet-desktop-guide/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md index 69e34d4..f3030db 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md @@ -39,6 +39,6 @@ This procedure shows you how to copy a Windows Presentation Foundation (WPF) con - - -- [Migration and Interoperability](https://docs.microsoft.com/dotnet/framework/wpf/advanced/migration-and-interoperability) +- [Migration and Interoperability](/dotnet/framework/wpf/advanced/migration-and-interoperability) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/how-to-create-application-settings.md b/dotnet-desktop-guide/framework/winforms/advanced/how-to-create-application-settings.md index 0797feb..c065456 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/how-to-create-application-settings.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/how-to-create-application-settings.md @@ -10,11 +10,12 @@ helpviewer_keywords: ms.assetid: 1e7aa347-af75-41e5-89ca-f53cab704f72 --- # How to: Create Application Settings + Using managed code, you can create new application settings and bind them to properties on your form or your form's controls, so that these settings are loaded and saved automatically at run time. In the following procedure, you manually create a wrapper class that derives from . To this class you add a publicly accessible property for each application setting that you want to expose. - You can also perform this procedure using minimal code in the Visual Studio designer. Also see [How to: Create Application Settings Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/wabtadw6(v=vs.100)). + You can also perform this procedure using minimal code in the Visual Studio designer. Also see [How to: Create Application Settings Using the Designer](/previous-versions/visualstudio/visual-studio-2010/wabtadw6(v=vs.100)). ### To create new Application Settings programmatically @@ -38,6 +39,7 @@ Using managed code, you can create new application settings and bind them to pro You have now successfully created a new application setting and bound it to the specified property. ## .NET Framework Security + The default settings provider, , persists information to configuration files as plain text. This limits security to the file access security provided by the operating system for the current user. Because of this, care must be taken with the information stored in configuration files. For example, one common use for application settings is to store connection strings that point to the application's data store. However, because of security concerns, such strings should not include passwords. For more information about connection strings, see . ## See also diff --git a/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md b/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md index 0ab2f81..74ac1ba 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md @@ -51,7 +51,7 @@ The easiest way to inherit a form or other object is to use the **Inheritance Pi ## See also -- [Inherits Statement](https://docs.microsoft.com/dotnet/visual-basic/language-reference/statements/inherits-statement) -- [using](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/using) +- [Inherits Statement](/dotnet/visual-basic/language-reference/statements/inherits-statement) +- [using](/dotnet/csharp/language-reference/keywords/using) - [Effects of Modifying a Base Form's Appearance](effects-of-modifying-base-form-appearance.md) - [Windows Forms Visual Inheritance](windows-forms-visual-inheritance.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-windows-forms.md b/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-windows-forms.md index d618554..dec464e 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/how-to-inherit-windows-forms.md @@ -34,12 +34,12 @@ For more information about inheriting forms at design time using the **Inheritan public class Form2 : Namespace1.Form1 ``` - When inheriting forms, keep in mind that issues may arise with regard to event handlers being called twice, because each event is being handled by both the base class and the inherited class. For more information on how to avoid this problem, see [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers). + When inheriting forms, keep in mind that issues may arise with regard to event handlers being called twice, because each event is being handled by both the base class and the inherited class. For more information on how to avoid this problem, see [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers). ## See also -- [Inherits Statement](https://docs.microsoft.com/dotnet/visual-basic/language-reference/statements/inherits-statement) -- [Imports Statement (.NET Namespace and Type)](https://docs.microsoft.com/dotnet/visual-basic/language-reference/statements/imports-statement-net-namespace-and-type) -- [using](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/using) +- [Inherits Statement](/dotnet/visual-basic/language-reference/statements/inherits-statement) +- [Imports Statement (.NET Namespace and Type)](/dotnet/visual-basic/language-reference/statements/imports-statement-net-namespace-and-type) +- [using](/dotnet/csharp/language-reference/keywords/using) - [Effects of Modifying a Base Form's Appearance](effects-of-modifying-base-form-appearance.md) - [Windows Forms Visual Inheritance](windows-forms-visual-inheritance.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md index 4c97493..9967e80 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: 362427f8-03d4-4826-b49f-60ab066ad322 --- # How to: Print a Multi-Page Text File in Windows Forms + It is very common for Windows-based applications to print text. The class provides methods for drawing objects (graphics or text) to a device, such as a screen or printer. > [!NOTE] @@ -42,17 +43,19 @@ It is very common for Windows-based applications to print text. The The root namespace for classes in the .NET Framework that handle network connectivity. @@ -23,7 +25,8 @@ The .NET Framework provides classes for displaying Web pages, downloading Web co A managed wrapper class for the `WebBrowser` control that is included with Windows. ## Related Sections - [Network Programming in the .NET Framework](https://docs.microsoft.com/dotnet/framework/network-programming/index) + + [Network Programming in the .NET Framework](/dotnet/framework/network-programming/index) An introduction to networking in the .NET Framework. [Windows Forms Data Binding](../windows-forms-data-binding.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/using-wpf-controls.md b/dotnet-desktop-guide/framework/winforms/advanced/using-wpf-controls.md index 6e61f8f..f3ed06f 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/using-wpf-controls.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/using-wpf-controls.md @@ -19,4 +19,4 @@ You can also use Windows Forms controls in WPF-based applications. For more info ## See also -- [WPF and Windows Forms interoperation](https://docs.microsoft.com/dotnet/framework/wpf/advanced/wpf-and-windows-forms-interoperation) +- [WPF and Windows Forms interoperation](/dotnet/framework/wpf/advanced/wpf-and-windows-forms-interoperation) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md index 2b57c4c..19fa40b 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md @@ -130,6 +130,6 @@ A WPF control hosted on a form has the same anchoring and docking behavior as ot - [How to: Anchor and Dock Child Controls in a TableLayoutPanel Control](../controls/how-to-anchor-and-dock-child-controls-in-a-tablelayoutpanel-control.md) - [How to: Align a Control to the Edges of Forms at Design Time](../controls/how-to-align-a-control-to-the-edges-of-forms-at-design-time.md) - [Walkthrough: Arranging Controls on Windows Forms Using Snaplines](../controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines.md) -- [Migration and Interoperability](https://docs.microsoft.com/dotnet/framework/wpf/advanced/migration-and-interoperability) +- [Migration and Interoperability](/dotnet/framework/wpf/advanced/migration-and-interoperability) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md index 599c379..92bfb46 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md @@ -83,6 +83,6 @@ You can assign different WPF content to an - -- [Migration and Interoperability](https://docs.microsoft.com/dotnet/framework/wpf/advanced/migration-and-interoperability) +- [Migration and Interoperability](/dotnet/framework/wpf/advanced/migration-and-interoperability) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md index d373721..6a7554d 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md @@ -28,7 +28,7 @@ This walkthrough will address the five accessibility requirements for the Certif For more information, see [Resources for Designing Accessible Applications](/visualstudio/ide/reference/resources-for-designing-accessible-applications). -For information on supporting varying keyboard layouts, see [Best Practices for Developing World-Ready Applications](https://docs.microsoft.com/dotnet/standard/globalization-localization/best-practices-for-developing-world-ready-apps). +For information on supporting varying keyboard layouts, see [Best Practices for Developing World-Ready Applications](/dotnet/standard/globalization-localization/best-practices-for-developing-world-ready-apps). ## Creating the Project @@ -285,7 +285,7 @@ In this application, no information is conveyed by sound alone. If you use sound #### To supply information by some other means than sound -1. Make the title bar flash by using the Windows API function FlashWindow. For an example of how to call Windows API functions, see [Walkthrough: Calling Windows APIs](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/com-interop/walkthrough-calling-windows-apis). +1. Make the title bar flash by using the Windows API function FlashWindow. For an example of how to call Windows API functions, see [Walkthrough: Calling Windows APIs](/dotnet/visual-basic/programming-guide/com-interop/walkthrough-calling-windows-apis). > [!NOTE] > The user may have the Windows SoundSentry service enabled, which will also cause the window to flash when the system sounds are played through the computer's built-in speaker. diff --git a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md index 38f6d2a..f100c71 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md @@ -90,9 +90,9 @@ To add a WPF control to a Windows Form: Windows Forms and WPF are different technologies, but they are designed to interoperate closely. To provide richer appearance and behavior in your applications, try the following: -- Host a Windows Forms control in a WPF page. For more information, see [Walkthrough: Hosting a Windows Forms Control in WPF](https://docs.microsoft.com/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf). +- Host a Windows Forms control in a WPF page. For more information, see [Walkthrough: Hosting a Windows Forms Control in WPF](/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf). -- Apply Windows Forms visual styles to your WPF content. For more information, see [How to: Enable Visual Styles in a Hybrid Application](https://docs.microsoft.com/dotnet/framework/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application). +- Apply Windows Forms visual styles to your WPF content. For more information, see [How to: Enable Visual Styles in a Hybrid Application](/dotnet/framework/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application). - Change the style of your WPF content. For more information, see [Walkthrough: Styling WPF Content](walkthrough-styling-wpf-content.md). @@ -100,6 +100,6 @@ Windows Forms and WPF are different technologies, but they are designed to inter - - -- [Migration and Interoperability](https://docs.microsoft.com/dotnet/framework/wpf/advanced/migration-and-interoperability) +- [Migration and Interoperability](/dotnet/framework/wpf/advanced/migration-and-interoperability) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-styling-wpf-content.md b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-styling-wpf-content.md index f25c56f..70c85e9 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-styling-wpf-content.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/walkthrough-styling-wpf-content.md @@ -55,7 +55,7 @@ You can apply different styling to a WPF control to change its appearance and be `UserControl1` opens in the WPF Designer. -1. In XAML view, insert the following XAML after the `` opening tag. This XAML creates a gradient with a contrasting gradient border. When the control is clicked, the gradients are changed to generate a pressed button look. For more information, see [Styling and Templating](https://docs.microsoft.com/dotnet/desktop-wpf/fundamentals/styles-templates-overview). +1. In XAML view, insert the following XAML after the `` opening tag. This XAML creates a gradient with a contrasting gradient border. When the control is clicked, the gradients are changed to generate a pressed button look. For more information, see [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview). ```xaml @@ -132,8 +132,8 @@ You can apply different styling to a WPF control to change its appearance and be - - -- [Migration and Interoperability](https://docs.microsoft.com/dotnet/framework/wpf/advanced/migration-and-interoperability) +- [Migration and Interoperability](/dotnet/framework/wpf/advanced/migration-and-interoperability) - [Using WPF Controls](using-wpf-controls.md) - [Design XAML in Visual Studio](/visualstudio/xaml-tools/designing-xaml-in-visual-studio) -- [XAML Overview (WPF)](https://docs.microsoft.com/dotnet/desktop-wpf/fundamentals/xaml) -- [Styling and Templating](https://docs.microsoft.com/dotnet/desktop-wpf/fundamentals/styles-templates-overview) +- [XAML Overview (WPF)](/dotnet/desktop-wpf/fundamentals/xaml) +- [Styling and Templating](/dotnet/desktop-wpf/fundamentals/styles-templates-overview) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md index 462c2fe..667bfcd 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md @@ -10,14 +10,16 @@ helpviewer_keywords: ms.assetid: 0a26d99d-8135-4895-8760-c9a2b5f67f14 --- # Windows Forms and Unmanaged Applications Overview + Windows Forms applications and controls can interoperate with unmanaged applications, with some caveats. The following sections describe the scenarios and configurations that Windows Forms applications and controls support and those that they do not support. ## Windows Forms Controls and ActiveX Applications + With the exception of Microsoft Internet Explorer and Microsoft Foundation Classes (MFC), Windows Forms controls are not supported in applications designed to host ActiveX controls. Other applications and development tools that are capable of hosting ActiveX controls, including the ActiveX test containers from versions of Visual Studio that are earlier than Visual Studio .NET 2003, are not supported hosts for Windows Forms controls. These constraints also apply to the use of Windows Forms controls through Component Object Model COM interop. The use of a Windows Forms control through a COM callable wrapper (CCW) is supported only in Internet Explorer. For more information about COM interop, see - [COM Interop](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/com-interop/index). + [COM Interop](/dotnet/visual-basic/programming-guide/com-interop/index). The following table shows the available ActiveX hosting support for Windows Forms controls. @@ -27,6 +29,7 @@ Windows Forms applications and controls can interoperate with unmanaged applicat |.NET Framework version 1.1 and later|Internet Explorer 5.01 and later versions

Microsoft Foundation Classes (MFC) 7.0 and later| ## Hosting Windows Forms components as ActiveX controls + In the .NET Framework 1.1, support was extended to include MFC 7.0 and later versions. This support includes any container that is fully compatible with the MFC 7.0 and later ActiveX control container. However, registration of Windows Forms controls as ActiveX controls is not supported. Also, calling the `com.ms.win32.Ole32.CoCreateInstance` method for Windows Forms controls is not supported. Only managed activation of Windows Forms controls is supported. Once you create a Windows Forms control, you can host it in an MFC application just as with an ActiveX control. @@ -34,6 +37,7 @@ Windows Forms applications and controls can interoperate with unmanaged applicat To use Windows Forms controls in your unmanaged application, you must either host the CLR using the unmanaged CLR hosting APIs or use the C++ interop features. Using the C++ interop features is the recommended solution. ## Windows Forms in COM client applications + When you open a Windows Form from a COM client application, such as a Visual Basic 6.0 application or an MFC application, the form may behave unexpectedly. For example, when you press the TAB key, the focus does not change from one control to another control. When you press the ENTER key while a command button has focus, the button's event is not raised. You may also experience unexpected behavior for keystrokes or mouse activity. This behavior occurs because the unmanaged application does not implement the message loop support that Windows Forms requires to work correctly. The message loop provided by the COM client application is fundamentally different from the Windows Forms message loop. @@ -41,6 +45,7 @@ Windows Forms applications and controls can interoperate with unmanaged applicat An application's message loop is an internal program loop that retrieves messages from a thread's message queue, translates them, and then sends them to the application to be handled. The message loop for a Windows Form does not have the same architecture as message loops that earlier applications, such as Visual Basic 6.0 applications and MFC applications, provide. The window messages that are posted to the message loop may be handled differently than the Windows Form expects. Therefore, unexpected behavior may occur. Some keystroke combinations may not work, some mouse activity may not work, or some events may not be raised as expected. ## Resolving Interoperability Issues + You can resolve these problems by displaying the form on a .NET Framework message loop, which is created by using the method. To make a Windows Form work correctly from a COM client application, you must run it on a Windows Forms message loop. To do this, use one of the following approaches: @@ -52,12 +57,12 @@ Windows Forms applications and controls can interoperate with unmanaged applicat ## See also - [Windows Forms and Unmanaged Applications](windows-forms-and-unmanaged-applications.md) -- [COM Interop](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/com-interop/index) -- [COM Interoperability in .NET Framework Applications](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/com-interop/com-interoperability-in-net-framework-applications) -- [COM Interoperability Samples](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/cxcz83xf(v=vs.90)) -- [Aximp.exe (Windows Forms ActiveX Control Importer)](https://docs.microsoft.com/dotnet/framework/tools/aximp-exe-windows-forms-activex-control-importer) -- [Exposing .NET Framework Components to COM](https://docs.microsoft.com/dotnet/framework/interop/exposing-dotnet-components-to-co) -- [Packaging an Assembly for COM](https://docs.microsoft.com/dotnet/framework/interop/packaging-an-assembly-for-co) -- [Registering Assemblies with COM](https://docs.microsoft.com/dotnet/framework/interop/registering-assemblies-with-co) +- [COM Interop](/dotnet/visual-basic/programming-guide/com-interop/index) +- [COM Interoperability in .NET Framework Applications](/dotnet/visual-basic/programming-guide/com-interop/com-interoperability-in-net-framework-applications) +- [COM Interoperability Samples](/previous-versions/visualstudio/visual-studio-2008/cxcz83xf(v=vs.90)) +- [Aximp.exe (Windows Forms ActiveX Control Importer)](/dotnet/framework/tools/aximp-exe-windows-forms-activex-control-importer) +- [Exposing .NET Framework Components to COM](/dotnet/framework/interop/exposing-dotnet-components-to-co) +- [Packaging an Assembly for COM](/dotnet/framework/interop/packaging-an-assembly-for-co) +- [Registering Assemblies with COM](/dotnet/framework/interop/registering-assemblies-with-co) - [How to: Support COM Interop by Displaying a Windows Form with the ShowDialog Method](com-interop-by-displaying-a-windows-form-shadow.md) - [How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread](how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md) diff --git a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md index 583e34f..98d4091 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md @@ -10,9 +10,11 @@ helpviewer_keywords: ms.assetid: 81bc100c-fa49-4614-85a6-0f7ab59eac8a --- # Windows Forms and Unmanaged Applications + Windows Forms applications and controls can interoperate with unmanaged applications, with some caveats. The following sections describe the scenarios and configurations that Windows Forms applications and controls support and those that they do not support. ## In This Section + [Windows Forms and Unmanaged Applications Overview](windows-forms-and-unmanaged-applications-overview.md) Offers general information about how to use and implement Windows Forms controls that work with unmanaged applications. @@ -22,9 +24,10 @@ Windows Forms applications and controls can interoperate with unmanaged applicat [How to: Support COM Interop by Displaying Each Windows Form on Its Own Thread](how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md) Provides a code example that shows how to run a Windows Form on its own thread. - Also see [Walkthrough: Supporting COM Interop by Displaying Each Windows Form on Its Own Thread](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233639(v=vs.100)). + Also see [Walkthrough: Supporting COM Interop by Displaying Each Windows Form on Its Own Thread](/previous-versions/visualstudio/visual-studio-2010/ms233639(v=vs.100)). ## Reference + Used to create a separate thread for a Windows Form. @@ -35,5 +38,6 @@ Windows Forms applications and controls can interoperate with unmanaged applicat Marshals calls from an unmanaged application to a form. ## Related Sections - [Exposing .NET Framework Components to COM](https://docs.microsoft.com/dotnet/framework/interop/exposing-dotnet-components-to-co) + + [Exposing .NET Framework Components to COM](/dotnet/framework/interop/exposing-dotnet-components-to-co) Offers general information about how to use .NET Framework types in unmanaged applications. diff --git a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-visual-inheritance.md b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-visual-inheritance.md index 0cb8779..d75bfd3 100644 --- a/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-visual-inheritance.md +++ b/dotnet-desktop-guide/framework/winforms/advanced/windows-forms-visual-inheritance.md @@ -12,11 +12,13 @@ helpviewer_keywords: ms.assetid: 857eb737-3602-4d49-bd8b-f70d33ace345 --- # Windows Forms Visual Inheritance + Occasionally, you may decide that a project calls for a form similar to one that you have created in a previous project. Or, you may want to create a basic form with settings such as a watermark or certain control layout that you will then use again within a project, with each iteration containing modifications to the original form template. Form inheritance enables you to create a base form and then inherit from it and make modifications while preserving whatever original settings you need. You can create derived-class forms programmatically or by using the Visual Inheritance picker. ## In This Section + [How to: Inherit Windows Forms](how-to-inherit-windows-forms.md) Gives directions for creating inherited forms in code. @@ -33,11 +35,12 @@ Occasionally, you may decide that a project calls for a form similar to one that Gives directions for using the `GenerateMember` and `Modifiers` properties, which are relevant when the Windows Forms Designer generates a member variable for a component. ## Related Sections - [Inheritance basics (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics) + + [Inheritance basics (Visual Basic)](/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics) Describes how to define Visual Basic classes that serve as the basis for other classes. - [class](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/class) + [class](/dotnet/csharp/language-reference/keywords/class) Describes the C# approach of classes, in which single inheritance is allowed. - [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) + [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) Lists common issues that arise with event handlers in inherited components diff --git a/dotnet-desktop-guide/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md b/dotnet-desktop-guide/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md index 43fc096..69deaeb 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md +++ b/dotnet-desktop-guide/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md @@ -15,6 +15,7 @@ helpviewer_keywords: ms.assetid: 68be11de-1d5b-430e-901f-cfbe48d14b19 --- # How to: Add Custom Information to a TreeView or ListView Control (Windows Forms) + You can create a derived node in a Windows Forms control or a derived item in a control. Derivation allows you to add any fields you require, as well as custom methods and constructors for handling them. One use of this feature is to attach a Customer object to each tree node or list item. The examples here are for a control, but the same approach can be used for a control. ### To derive a tree node @@ -94,7 +95,7 @@ You can create a derived node in a Windows Forms class, then you will need to cast to your derived class. Casting is an explicit conversion from one type of object to another. For more information on casting, see [Implicit and Explicit Conversions](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/data-types/implicit-and-explicit-conversions) (Visual Basic), [Casting and type conversions](https://docs.microsoft.com/dotnet/csharp/programming-guide/types/casting-and-type-conversions) (Visual C#), or [Cast Operator: ()](/cpp/cpp/cast-operator-parens) (Visual C++). +2. If you are passed the tree node and it is typed as a class, then you will need to cast to your derived class. Casting is an explicit conversion from one type of object to another. For more information on casting, see [Implicit and Explicit Conversions](/dotnet/visual-basic/programming-guide/language-features/data-types/implicit-and-explicit-conversions) (Visual Basic), [Casting and type conversions](/dotnet/csharp/programming-guide/types/casting-and-type-conversions) (Visual C#), or [Cast Operator: ()](/cpp/cpp/cast-operator-parens) (Visual C++). ```vb Public Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect diff --git a/dotnet-desktop-guide/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md index ce85eb7..3c0a001 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md @@ -14,7 +14,7 @@ ms.assetid: 4a6d1b34-b696-476b-bf8a-57c6230aa9e1 You can display data in the Windows Forms control in tables and columns by creating objects and adding them to the object, which is accessed through the control's property. Each table style displays the contents of whatever data table is specified in the property of the . By default, a table style without column styles specified will display all the columns within that data table. You can restrict which columns from the table appear by adding objects to the , which is accessed through the property of each . -The following procedures require a **Windows Application** project with a form that contains a control. For information about how to set up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). By default in Visual Studio 2005, the control is not in the **Toolbox**. For information about adding it, see [How to: Add Items to the Toolbox](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). +The following procedures require a **Windows Application** project with a form that contains a control. For information about how to set up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). By default in Visual Studio 2005, the control is not in the **Toolbox**. For information about adding it, see [How to: Add Items to the Toolbox](/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). ### To add a table to the DataGrid control in the designer diff --git a/dotnet-desktop-guide/framework/winforms/controls/attributes-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/attributes-in-windows-forms-controls.md index 2ec1357..bb34e5c 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/attributes-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/attributes-in-windows-forms-controls.md @@ -9,9 +9,11 @@ helpviewer_keywords: ms.assetid: 2c5640e9-6c6c-49d7-a5e4-a768f6be7853 --- # Attributes in Windows Forms Controls + The .NET Framework provides a variety of attributes you can apply to the members of your custom controls and components. Some of these attributes affect the run-time behavior of a class, and others affect the design-time behavior. ## Attributes for Control and Component Properties + The following table shows the attributes you can apply to properties or other members of your custom controls and components. For an example that uses many of these attributes, see [How to: Apply Attributes in Windows Forms Controls](how-to-apply-attributes-in-windows-forms-controls.md). |Attribute|Description| @@ -32,6 +34,7 @@ The .NET Framework provides a variety of attributes you can apply to the members ||Specifies what type to use as a converter for the object this attribute is bound to.| ## Attributes for Data Binding Properties + The following table shows the attributes you can apply to specify how your custom controls and components interact with data binding. |Attribute|Description| @@ -43,6 +46,7 @@ The .NET Framework provides a variety of attributes you can apply to the members ||Enables attribute redirection.| ## Attributes for Classes + The following table shows the attributes you can apply to specify the behavior of your custom controls and components at design time. |Attribute|Description| @@ -58,5 +62,5 @@ The .NET Framework provides a variety of attributes you can apply to the members - - [How to: Apply Attributes in Windows Forms Controls](how-to-apply-attributes-in-windows-forms-controls.md) -- [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) +- [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) - [Developing Custom Windows Forms Controls with the .NET Framework](developing-custom-windows-forms-controls.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component-overview.md b/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component-overview.md index e9a72d6..28ebdaa 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component-overview.md +++ b/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component-overview.md @@ -19,6 +19,7 @@ helpviewer_keywords: ms.assetid: 64e9b3ab-7443-4a77-ab17-b8b8c0cb3f62 --- # BackgroundWorker Component Overview + There are many commonly performed operations that can take a long time to execute. For example: - Image downloads @@ -47,15 +48,15 @@ There are many commonly performed operations that can take a long time to execut [!code-csharp[System.ComponentModel.BackgroundWorker#5](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CS/fibonacciform.cs#5)] [!code-vb[System.ComponentModel.BackgroundWorker#5](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/VB/fibonacciform.vb#5)] - For more information on using event handlers, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). + For more information on using event handlers, see [Events](/dotnet/standard/events/index). > [!CAUTION] -> When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. +> When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. For more information on using the class, see [How to: Run an Operation in the Background](how-to-run-an-operation-in-the-background.md). ## See also -- [Managed Threading](https://docs.microsoft.com/dotnet/standard/threading/index) -- [Event-based Asynchronous Pattern Overview](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) +- [Managed Threading](/dotnet/standard/threading/index) +- [Event-based Asynchronous Pattern Overview](/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) - [How to: Implement a Form That Uses a Background Operation](how-to-implement-a-form-that-uses-a-background-operation.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component.md b/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component.md index 31c2f14..fc59b8c 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/backgroundworker-component.md @@ -13,9 +13,11 @@ helpviewer_keywords: ms.assetid: bef7b0ab-ce57-475a-a2d6-fb8a702a9417 --- # BackgroundWorker Component + The `BackgroundWorker` component enables your form or control to run an operation asynchronously. ## In This Section + [BackgroundWorker Component Overview](backgroundworker-component-overview.md) Describes the `BackgroundWorker` component, which gives you the ability to execute time-consuming operations asynchronously ("in the background"), on a thread different from your application's main UI thread. @@ -35,6 +37,7 @@ The `BackgroundWorker` component enables your form or control to run an operatio Demonstrates how to use the `BackgroundWorker` component to download a file on a separate thread. ## Reference + Describes this class and has links to all its members. @@ -45,5 +48,6 @@ The `BackgroundWorker` component enables your form or control to run an operatio Describes the type that holds data for the event. ## Related Sections - [Event-based Asynchronous Pattern Overview](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) + + [Event-based Asynchronous Pattern Overview](/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) Describes how the asynchronous pattern makes available the advantages of multithreaded applications while hiding many of the complex issues inherent in multithreaded design. diff --git a/dotnet-desktop-guide/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md index 2d3049e..0f7397a 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md @@ -8,11 +8,12 @@ helpviewer_keywords: ms.assetid: f4f46009-cec2-441b-8668-6b5af057558b --- # How to: Bind Data to the Windows Forms DataGridView Control Using the Designer + You can use the designer to connect a control to data sources of several different varieties, including databases, business objects, or Web services. When you bind the control to a data source using the designer, the control is automatically bound to a component that represents the data source. Additionally, columns are automatically generated in the control to match the schema information provided by the data source. After columns have been generated, you can modify them to meet your needs. For example, you can remove or hide columns you are not interested in displaying, you can rearrange the columns, or you can modify the column types. For more information about modifying columns, see the topics listed in the See Also section. - You can also bind multiple controls to related tables to create master/detail relationships. In this configuration, one control displays a parent table and another control displays only those rows from a child table that are related to the current row in the parent table. For more information, see [How to: Display Related Data in a Windows Forms Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)). + You can also bind multiple controls to related tables to create master/detail relationships. In this configuration, one control displays a parent table and another control displays only those rows from a child table that are related to the current row in the parent table. For more information, see [How to: Display Related Data in a Windows Forms Application](/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)). The following procedure requires a **Windows Application** project with a form that contains a control or two controls for a master/detail relationship. For information about starting such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). @@ -24,7 +25,7 @@ You can use the designer to connect a c 3. If your project does not already have a data source, click **Add Project Data Source** and follow the steps indicated by the wizard. - For more information, see [Data Source Configuration Wizard](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/w4dd7z6t(v=vs.120)). Your new data source will appear in the **Choose Data Source** drop-down window. If your new data source contains only one member, such as a single database table, the control will automatically bind to that member. Otherwise, continue to the next step. + For more information, see [Data Source Configuration Wizard](/previous-versions/visualstudio/visual-studio-2013/w4dd7z6t(v=vs.120)). Your new data source will appear in the **Choose Data Source** drop-down window. If your new data source contains only one member, such as a single database table, the control will automatically bind to that member. Otherwise, continue to the next step. 4. Expand the **Other Data Sources** and **Project Data Sources** nodes if they are not already expanded, and then select the data source to bind the control to. @@ -33,7 +34,7 @@ You can use the designer to connect a c 6. To create a master/detail relationship, in the **Choose Data Source** drop-down window for a second control, expand the created for the parent table, and then select the related child table from the list shown. > [!NOTE] - > If your project already has a data source, you can also use the **Data Sources** window to create a data form. For more information, see [Data Sources Window](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)). + > If your project already has a data source, you can also use the **Data Sources** window to create a data form. For more information, see [Data Sources Window](/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)). ## See also @@ -41,7 +42,7 @@ You can use the designer to connect a c - - - -- [How to: Connect to Data in a Database](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/fxk9yw1t(v=vs.120)) +- [How to: Connect to Data in a Database](/previous-versions/visualstudio/visual-studio-2013/fxk9yw1t(v=vs.120)) - [How to: Add and Remove Columns in the Windows Forms DataGridView Control Using the Designer](add-and-remove-columns-in-the-datagrid-using-the-designer.md) - [How to: Change the Order of Columns in the Windows Forms DataGridView Control Using the Designer](change-the-order-of-columns-in-the-datagrid-using-the-designer.md) - [How to: Change the Type of a Windows Forms DataGridView Column Using the Designer](change-the-type-of-a-wf-datagridview-column-using-the-designer.md) @@ -50,5 +51,5 @@ You can use the designer to connect a c - [How to: Make Columns Read-Only in the Windows Forms DataGridView Control Using the Designer](make-columns-read-only-in-the-datagrid-using-the-designer.md) - [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) - [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md) -- [Data Sources Window](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)) -- [How to: Display Related Data in a Windows Forms Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)) +- [Data Sources Window](/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)) +- [How to: Display Related Data in a Windows Forms Application](/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md b/dotnet-desktop-guide/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md index c026907..26b0610 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md +++ b/dotnet-desktop-guide/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md @@ -8,6 +8,7 @@ helpviewer_keywords: ms.assetid: 391ae170-de5c-40f8-8233-91cb2ee4683a --- # How to: Bind Windows Forms Controls with the BindingSource Component Using the Designer + After you have added controls to your form and determined the user interface for your application, you can bind the controls to a data source, so that, at run time, users can alter and save data related to the application. Binding a control or series of controls in Windows Forms is most easily accomplished using the control as a bridge between the controls on the form and the data source. @@ -55,4 +56,4 @@ After you have added controls to your form and determined the user interface for - - - [Add new data sources](/visualstudio/data-tools/add-new-data-sources) -- [Data Sources Window](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)) +- [Data Sources Window](/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md index 8b48542..308bbee 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md @@ -24,7 +24,7 @@ ms.assetid: 4e96e3d0-b1cc-4de1-8774-bc9970ec4554 You can also bind the grid programmatically, at run time. This is useful when you want to set a data source based on information you get at run time. For example, the application might let the user specify the name of a table to view. It is also necessary in situations where the data source does not exist at design time. This includes data sources such as arrays, collections, untyped datasets, and data readers. - The following procedure requires a **Windows Application** project with a form containing a control. For information about setting up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For information about adding it, see [How to: Add Items to the Toolbox](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). Additionally in Visual Studio 2005, you can use the **Data Sources** window for design-time data binding. For more information see [Bind controls to data in Visual Studio](/visualstudio/data-tools/bind-controls-to-data-in-visual-studio). + The following procedure requires a **Windows Application** project with a form containing a control. For information about setting up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For information about adding it, see [How to: Add Items to the Toolbox](/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). Additionally in Visual Studio 2005, you can use the **Data Sources** window for design-time data binding. For more information see [Bind controls to data in Visual Studio](/visualstudio/data-tools/bind-controls-to-data-in-visual-studio). ## To data-bind the DataGrid control to a single table in the designer diff --git a/dotnet-desktop-guide/framework/winforms/controls/button-control-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/button-control-windows-forms.md index 4b73c93..090b090 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/button-control-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/button-control-windows-forms.md @@ -7,9 +7,11 @@ helpviewer_keywords: ms.assetid: d38bc40c-8040-4f19-9e88-2c665b0ab80b --- # Button Control (Windows Forms) + The Windows Forms `Button` control allows the user to click it to perform an action. The `Button` control can display both text and images. When the button is clicked, it looks as if it is being pushed in and released. ## In This Section + [Button Control Overview](button-control-overview-windows-forms.md) Explains what this control is and its key features and properties. @@ -28,11 +30,13 @@ The Windows Forms `Button` control allows the user to click it to perform an act Also see [How to: Designate a Windows Forms Button as the Accept Button Using the Designer](designate-a-wf-button-as-the-accept-button-using-the-designer.md) and [How to: Designate a Windows Forms Button as the Cancel Button Using the Designer](designate-a-wf-button-as-the-cancel-button-using-the-designer.md). ## Reference + class Describes this class and has links to all its members. ## Related Sections + [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) Provides a complete list of Windows Forms controls, with links to information on their use. - Also see [User Input to Dialog Boxes](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/1s9ws53w(v=vs.100)) and [How to: Close Dialog Boxes and Retain User Input](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/65ad5907(v=vs.100)). + Also see [User Input to Dialog Boxes](/previous-versions/visualstudio/visual-studio-2010/1s9ws53w(v=vs.100)) and [How to: Close Dialog Boxes and Retain User Input](/previous-versions/visualstudio/visual-studio-2010/65ad5907(v=vs.100)). diff --git a/dotnet-desktop-guide/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md b/dotnet-desktop-guide/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md index 48c3b4f..ee69bc9 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: 0c7a6d00-30de-416e-8223-0a81ddb4c1f8 --- # How to: Change Displayed Data at Run Time in the Windows Forms DataGrid Control + > [!NOTE] > The control replaces and adds functionality to the control; however, the control is retained for both backward compatibility and future use, if you choose. For more information, see [Differences Between the Windows Forms DataGridView and DataGrid Controls](differences-between-the-windows-forms-datagridview-and-datagrid-controls.md). @@ -89,7 +90,7 @@ ms.assetid: 0c7a6d00-30de-416e-8223-0a81ddb4c1f8 ## See also -- [ADO.NET DataSets](https://docs.microsoft.com/dotnet/framework/data/adonet/ado-net-datasets) +- [ADO.NET DataSets](/dotnet/framework/data/adonet/ado-net-datasets) - [How to: Delete or Hide Columns in the Windows Forms DataGrid Control](how-to-delete-or-hide-columns-in-the-windows-forms-datagrid-control.md) - [How to: Add Tables and Columns to the Windows Forms DataGrid Control](how-to-add-tables-and-columns-to-the-windows-forms-datagrid-control.md) - [How to: Bind the Windows Forms DataGrid Control to a Data Source](how-to-bind-the-windows-forms-datagrid-control-to-a-data-source.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md b/dotnet-desktop-guide/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md index 017af20..08418ea 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md +++ b/dotnet-desktop-guide/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md @@ -10,6 +10,7 @@ helpviewer_keywords: ms.assetid: 2509302d-a74e-484f-9890-2acdbfa67a68 --- # Considerations When Hosting an ActiveX Control on a Windows Form + Although Windows Forms have been optimized to host Windows Forms controls, you can still use ActiveX controls. Keep the following considerations in mind when planning an application that uses ActiveX controls: - **Security** The common language runtime has been enhanced with regard to code access security. Applications featuring Windows Forms can run in a fully trusted environment without issue and in a semi-trusted environment with most of the functionality accessible. Windows Forms controls can be hosted in a browser with no complications. However, ActiveX controls on Windows Forms cannot take advantage of these security enhancements. Running an ActiveX control requires unmanaged code permission, which is set with the property. For more information about security and unmanaged code permission, see . @@ -17,15 +18,14 @@ Although Windows Forms have been optimized to host Windows Forms controls, you c - **Total Cost of Ownership** ActiveX controls added to a Windows Form are deployed with that Windows Form in their entirety, which can add significantly to the size of the file(s) created. Additionally, using ActiveX controls on Windows Forms requires writing to the registry. This is more invasive to a user's computer than Windows Forms controls, which do not require this. > [!NOTE] - > Working with an ActiveX control requires the use of a COM interop wrapper. For more information, see [COM Interoperability in Visual Basic and Visual C#](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/com-interop/com-interoperability-in-net-framework-applications). - + > Working with an ActiveX control requires the use of a COM interop wrapper. For more information, see [COM Interoperability in Visual Basic and Visual C#](/dotnet/visual-basic/programming-guide/com-interop/com-interoperability-in-net-framework-applications). > [!NOTE] > If the name of a member of the ActiveX control matches a name defined in the .NET Framework, then the ActiveX Control Importer will prefix the member name with **Ctl** when it creates the derived class. For example, if your ActiveX control has a member named **Layout**, it is renamed **CtlLayout** in the AxHost-derived class because the **Layout** event is defined within the .NET Framework. ## See also - [How to: Add ActiveX Controls to Windows Forms](how-to-add-activex-controls-to-windows-forms.md) -- [Code Access Security](https://docs.microsoft.com/dotnet/framework/misc/code-access-security) -- [Controls and Programmable Objects Compared in Various Languages and Libraries](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) +- [Code Access Security](/dotnet/framework/misc/code-access-security) +- [Controls and Programmable Objects Compared in Various Languages and Libraries](/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) - [Putting Controls on Windows Forms](putting-controls-on-windows-forms.md) - [Windows Forms Controls](index.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/contextmenustrip-control.md b/dotnet-desktop-guide/framework/winforms/controls/contextmenustrip-control.md index 8541ced..deed1f6 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/contextmenustrip-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/contextmenustrip-control.md @@ -8,9 +8,11 @@ helpviewer_keywords: ms.assetid: 76e070b2-65d7-457f-8300-d104e4e01e5e --- # ContextMenuStrip Control + The control provides a shortcut menu that you associate with a control. ## In This Section + [ContextMenuStrip Control Overview](contextmenustrip-control-overview.md) Explains what the control is and its key features and properties. @@ -29,9 +31,10 @@ The control provides a shortcut men [How to: Handle the ContextMenuStrip Opening Event](how-to-handle-the-contextmenustrip-opening-event.md) Describes how to customize the behavior of a control by handling the event. - Also see [ContextMenuStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233646(v=vs.100)) or [ContextMenuStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233641(v=vs.100)). + Also see [ContextMenuStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233646(v=vs.100)) or [ContextMenuStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233641(v=vs.100)). ## Reference + Describes the features of the class, which provides a menu system for a form. @@ -42,5 +45,6 @@ The control provides a shortcut men Describes the features of the class, which represents a selectable option displayed on a or . ## Related Sections + [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) Provides a complete list of Windows Forms controls, with links to information on their use. diff --git a/dotnet-desktop-guide/framework/winforms/controls/control-type-recommendations.md b/dotnet-desktop-guide/framework/winforms/controls/control-type-recommendations.md index 85e133b..8b163b2 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/control-type-recommendations.md +++ b/dotnet-desktop-guide/framework/winforms/controls/control-type-recommendations.md @@ -13,7 +13,7 @@ ms.assetid: 5235fe9d-c36a-4c08-ae76-6cb90b50085e The .NET Framework gives you power to develop and implement new controls. In addition to the familiar user control, you will now find that you are able to write custom controls that perform their own painting, and are even able to extend the functionality of existing controls through inheritance. Deciding which type of control to create can be confusing. This section highlights the differences between the various types of controls from which you can inherit, and gives considerations regarding the type to choose for your project. > [!NOTE] -> If you want to author a control to use on Web Forms, see [Developing Custom ASP.NET Server Controls](https://docs.microsoft.com/previous-versions/aspnet/zt27tfhy(v=vs.100)). +> If you want to author a control to use on Web Forms, see [Developing Custom ASP.NET Server Controls](/previous-versions/aspnet/zt27tfhy(v=vs.100)). ## Inheriting from a Windows Forms Control @@ -73,7 +73,7 @@ Inherit from the class if: - [Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features](creating-a-wf-control-design-time-features.md) -- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) +- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/controls-to-use-on-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/controls-to-use-on-windows-forms.md index 689be23..b6f4566 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/controls-to-use-on-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/controls-to-use-on-windows-forms.md @@ -8,12 +8,14 @@ helpviewer_keywords: ms.assetid: dec51976-eae0-4398-a537-20bca7974722 --- # Controls to Use on Windows Forms + The following is an alphabetic list of controls and components that can be used on Windows Forms. In addition to the Windows Forms controls covered in this section, you can add ActiveX and custom controls to Windows Forms. If you do not find the control you need listed here, you can also create your own. For details, see [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md). For more information about choosing the control you need, see [Windows Forms Controls by Function](windows-forms-controls-by-function.md). > [!NOTE] > Visual Basic controls are based on classes provided by the .NET Framework. ## In This Section + [Windows Forms Controls by Function](windows-forms-controls-by-function.md) Lists and describes Windows Forms controls based on the .NET Framework. @@ -219,13 +221,14 @@ The following is an alphabetic list of controls and components that can be used Describes a set of controls used to provide users with a list of options to choose from. ## Related Sections + [Windows Forms Controls](index.md) Explains the use of Windows Forms controls, and describes important concepts for working with them. [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md) Provides links to step-by-step topics, recommendations for which kind of control to create, and other information about creating your own control. - [Controls and Programmable Objects Compared in Various Languages and Libraries](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) + [Controls and Programmable Objects Compared in Various Languages and Libraries](/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) Provides a table that maps controls in Visual Basic 6.0 to the corresponding control in Visual Basic .NET. Note that controls are now classes in the .NET Framework. [How to: Add ActiveX Controls to Windows Forms](how-to-add-activex-controls-to-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md b/dotnet-desktop-guide/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md index 2c89f78..13c5a10 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md +++ b/dotnet-desktop-guide/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md @@ -16,6 +16,7 @@ helpviewer_keywords: ms.assetid: 4ce35f12-1f4e-4317-92d1-af8686a8cfaa --- # How to: Create a Lookup Table for a Windows Forms ComboBox, ListBox, or CheckedListBox Control + Sometimes it is useful to display data in a user-friendly format on a Windows Form, but store the data in a format that is more meaningful to your program. For example, an order form for food might display the menu items by name in a list box. However, the data table recording the order would contain the unique ID numbers representing the food. The following tables show an example of how to store and display order-form data for food. ### OrderDetailsTable @@ -44,7 +45,7 @@ Sometimes it is useful to display data in a user-friendly format on a Windows Fo 2. Connect to your data source. -3. Establish a data relation between the two tables. See [Introduction to DataRelation Objects](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/0k21zcyx(v=vs.120)). +3. Establish a data relation between the two tables. See [Introduction to DataRelation Objects](/previous-versions/visualstudio/visual-studio-2013/0k21zcyx(v=vs.120)). 4. Set the following properties. They can be set in code or in the designer. diff --git a/dotnet-desktop-guide/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md b/dotnet-desktop-guide/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md index 900a51f..dfe282b 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md +++ b/dotnet-desktop-guide/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md @@ -11,6 +11,7 @@ helpviewer_keywords: ms.assetid: 99f6e876-3f7f-4139-9063-e36587c95b02 --- # How to: Create a Master/Detail Form Using Two Windows Forms DataGridView Controls + The following code example creates a master/detail form using two controls bound to two components. The data source is a that contains the `Customers` and `Orders` tables from the Northwind SQL Server sample database along with a that relates the two through the `CustomerID` column. One is bound to the parent `Customers` table in the data set. This data is displayed in the master control. The other is bound to the first data connector. The property of the second is set to the name. This causes the associated detail control to display the rows of the child `Orders` table that correspond to the current row in the master control. @@ -18,16 +19,19 @@ The following code example creates a master/detail form using two - [Walkthrough: Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls](creating-a-master-detail-form-using-two-datagridviews.md) - [Displaying Data in the Windows Forms DataGridView Control](displaying-data-in-the-windows-forms-datagridview-control.md) -- [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information) +- [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information) diff --git a/dotnet-desktop-guide/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md index d6e73f7..9a45b2b 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md @@ -18,10 +18,10 @@ ms.assetid: 19438ba2-f687-4417-a2fb-ab1cd69d4ded ## To create a master-details list in the designer -1. Add two controls to the form. For more information, see [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For more information, see [How to: Add Items to the Toolbox](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). +1. Add two controls to the form. For more information, see [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For more information, see [How to: Add Items to the Toolbox](/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). > [!NOTE] - > The following steps are not applicable to Visual Studio 2005, which uses the **Data Sources** window for design-time data binding. For more information, see [Bind controls to data in Visual Studio](/visualstudio/data-tools/bind-controls-to-data-in-visual-studio) and [How to: Display Related Data in a Windows Forms Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)). + > The following steps are not applicable to Visual Studio 2005, which uses the **Data Sources** window for design-time data binding. For more information, see [Bind controls to data in Visual Studio](/visualstudio/data-tools/bind-controls-to-data-in-visual-studio) and [How to: Display Related Data in a Windows Forms Application](/previous-versions/visualstudio/visual-studio-2013/57tx3hhe(v=vs.120)). 2. Drag two or more tables from **Server Explorer** to the form. diff --git a/dotnet-desktop-guide/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md b/dotnet-desktop-guide/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md index 2210a14..46ce7d7 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md +++ b/dotnet-desktop-guide/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md @@ -39,7 +39,7 @@ In order to complete this walkthrough, you will need: 2. Implement a method in your form's class definition for handling the detail of connecting to the database. This example uses a `GetData` method that populates a object, adds a object to the data set, and binds the components. Be sure to set the `connectionString` variable to a value that is appropriate for your database. > [!IMPORTANT] - > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). + > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataGridViewMasterDetails#20](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMasterDetails/CS/masterdetails.cs#20)] [!code-vb[System.Windows.Forms.DataGridViewMasterDetails#20](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMasterDetails/VB/masterdetails.vb#20)] @@ -79,4 +79,4 @@ This application gives you a basic understanding of the - [Displaying Data in the Windows Forms DataGridView Control](displaying-data-in-the-windows-forms-datagridview-control.md) - [How to: Create a Master/Detail Form Using Two Windows Forms DataGridView Controls](create-a-master-detail-form-using-two-datagridviews.md) -- [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information) +- [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information) diff --git a/dotnet-desktop-guide/framework/winforms/controls/creating-a-wf-control-design-time-features.md b/dotnet-desktop-guide/framework/winforms/controls/creating-a-wf-control-design-time-features.md index dfa4809..73e9220 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/creating-a-wf-control-design-time-features.md +++ b/dotnet-desktop-guide/framework/winforms/controls/creating-a-wf-control-design-time-features.md @@ -29,7 +29,7 @@ When you're finished with this walkthrough, your custom control will look someth ![The app showing a marquee saying Text and a Start and Stop buttons.](./media/creating-a-wf-control-design-time-features/demo-marquee-control.gif) -For the complete code listing, see [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)). +For the complete code listing, see [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)). ## Prerequisites @@ -601,7 +601,7 @@ The `MarqueeControlLibrary` demonstrates a simple implementation of custom contr - License the `MarqueeControl`. -- Control how your controls are serialized and how code is generated for them. For more information, see [Dynamic Source Code Generation and Compilation](https://docs.microsoft.com/dotnet/framework/reflection-and-codedom/dynamic-source-code-generation-and-compilation). +- Control how your controls are serialized and how code is generated for them. For more information, see [Dynamic Source Code Generation and Compilation](/dotnet/framework/reflection-and-codedom/dynamic-source-code-generation-and-compilation). ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md b/dotnet-desktop-guide/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md index 74481fc..b65040c 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md @@ -8,14 +8,17 @@ helpviewer_keywords: ms.assetid: 07bf558d-3748-42ba-8ba0-37fdef924081 --- # Data Formatting in the Windows Forms DataGridView Control + The control provides automatic conversion between cell values and the data types that the parent columns display. Text box columns, for example, display string representations of date, time, number, and enumeration values, and convert user-entered string values to the types required by the data store. ## Formatting with the DataGridViewCellStyle class - The control provides basic data formatting of cell values through the class. You can use the property to format date, time, number, and enumeration values for the current default culture using the format specifiers described in [Formatting Types](https://docs.microsoft.com/dotnet/standard/base-types/formatting-types). You can also format these values for specific cultures using the property. The specified format is used both to display data and to parse data that the user enters in the specified format. + + The control provides basic data formatting of cell values through the class. You can use the property to format date, time, number, and enumeration values for the current default culture using the format specifiers described in [Formatting Types](/dotnet/standard/base-types/formatting-types). You can also format these values for specific cultures using the property. The specified format is used both to display data and to parse data that the user enters in the specified format. The class provides additional formatting properties for wordwrap, text alignment, and the custom display of null database values. For more information, see [How to: Format Data in the Windows Forms DataGridView Control](how-to-format-data-in-the-windows-forms-datagridview-control.md). ## Formatting with the CellFormatting Event + If the basic formatting does not meet your needs, you can provide custom data formatting in a handler for the event. The passed to the handler has a property that initially contains the cell value. Normally, this value is automatically converted to the display type. To convert the value yourself, set the property to a value of the display type. > [!NOTE] diff --git a/dotnet-desktop-guide/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md index a55983e..aa92528 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md @@ -7,22 +7,27 @@ helpviewer_keywords: ms.assetid: 094498c3-a126-4a3f-83fe-f69e96c7717b --- # DataGridView Control Technology Summary (Windows Forms) + This topic summarizes information about the `DataGridView` control and the classes that support its use. Displaying data in a tabular format is a task you are likely to perform frequently. The `DataGridView` control is designed to be a complete solution for presenting data in a grid. ## Keywords + DataGridView, BindingSource, table, cell, data binding, virtual mode ## Namespaces + ## Related Technologies + `BindingSource` ## Background + User interface (UI) designers frequently find it necessary to display tabular data to users. The .NET Framework provides several ways to show data in a table or grid. The `DataGridView` control represents the latest evolution of this technology for Windows Forms applications. The `DataGridView` control can display rows of data from a data store. Many types of data stores are supported. The data store can hold simple, untyped data, such as a one-dimensional array, or it can hold typed data, such as a . For more information, see [How to: Bind Data to the Windows Forms DataGridView Control](how-to-bind-data-to-the-windows-forms-datagridview-control.md). @@ -32,6 +37,7 @@ This topic summarizes information about the `DataGridView` control and the class You can extend the `DataGridView` control in several ways to build custom behavior into your applications. For example, you can programmatically specify your own sorting algorithms, and you can create your own types of cells. You can easily customize the appearance of the `DataGridView` control by choosing among several properties. Many types of data stores can be used as a data source, or the `DataGridView` control can operate without a data source bound to it. ## Implementing DataGridView Classes + There are several ways for you to take advantage of the `DataGridView` control's extensibility features. You can customize many aspects of the control through events and properties, but some customizations require you to create new classes derived from existing `DataGridView` classes. The most typically used base classes are `DataGridViewCell` and `DataGridViewColumn`. You can derive your own cell class from `DataGridViewCell` or any of its child classes. Although you can add any cell type to any column, you will typically also derive a companion column class from `DataGridViewColumn` that hosts cells of your custom cell type by default. @@ -41,6 +47,7 @@ This topic summarizes information about the `DataGridView` control and the class For more information, see [How to: Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance](customize-cells-and-columns-in-the-datagrid-by-extending-behavior.md) and [How to: Host Controls in Windows Forms DataGridView Cells](how-to-host-controls-in-windows-forms-datagridview-cells.md). ## DataGridView Classes at a Glance + |Technology Area|Classes/interfaces/configuration elements| @@ -50,6 +57,7 @@ This topic summarizes information about the `DataGridView` control and the class | Extensibility| and derived classes

and derived classes



| ## What's New + The control is designed to be a complete solution for displaying tabular data with Windows Forms. You should consider using the control before other solutions, such as , when you are authoring a new application. For more information, see [Differences Between the Windows Forms DataGridView and DataGrid Controls](differences-between-the-windows-forms-datagridview-and-datagrid-controls.md). The control can work in close conjunction with the component. This component is designed to be the primary data source of a form. It can manage the interaction between a control and its data source, regardless of the data source type. @@ -58,4 +66,4 @@ This topic summarizes information about the `DataGridView` control and the class - [DataGridView Control Overview](datagridview-control-overview-windows-forms.md) - [DataGridView Control Architecture](datagridview-control-architecture-windows-forms.md) -- [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information) +- [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information) diff --git a/dotnet-desktop-guide/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md index 29128bd..e3a28da 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md @@ -10,16 +10,17 @@ helpviewer_keywords: ms.assetid: c2eb8277-a842-4d99-89a9-647b901a0434 --- # Defining a Property in Windows Forms Controls -For an overview of properties, see [Properties Overview](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/65zdfbdt(v=vs.120)). There are a few important considerations when defining a property: + +For an overview of properties, see [Properties Overview](/previous-versions/visualstudio/visual-studio-2013/65zdfbdt(v=vs.120)). There are a few important considerations when defining a property: -- You must apply attributes to the properties you define. Attributes specify how the designer should display a property. For details, see [Design-Time Attributes for Components](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)). +- You must apply attributes to the properties you define. Attributes specify how the designer should display a property. For details, see [Design-Time Attributes for Components](/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)). - If changing the property affects the visual display of the control, call the method (that your control inherits from ) from the `set` accessor. in turn calls the method, which redraws the control. Multiple calls to result in a single call to for efficiency. - The .NET Framework class library provides type converters for common data types such as integers, decimal numbers, Boolean values, and others. The purpose of a type converter is generally to provide string-to-value conversion (from string data to other data types). Common data types are associated with default type converters that convert values into strings and strings into the appropriate data types. If you define a property that is a custom (that is, nonstandard) data type, you will have to apply an attribute that specifies the type converter to associate with that property. You can also use an attribute to associate a custom UI type editor with a property. A UI type editor provides a user interface for editing a property or data type. A color picker is an example of a UI type editor. Examples of attributes are given at the end of this topic. > [!NOTE] - > If a type converter or a UI type editor is not available for your custom property, you can implement one as described in [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)). + > If a type converter or a UI type editor is not available for your custom property, you can implement one as described in [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)). The following code fragment defines a custom property named `EndColor` for the custom control `FlashTrackBar`. diff --git a/dotnet-desktop-guide/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md index ffb3686..24eb42e 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md @@ -10,7 +10,8 @@ helpviewer_keywords: ms.assetid: d89f1096-8061-42e2-a855-a1f053f1940a --- # Defining an Event in Windows Forms Controls -For details about defining custom events, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). If you define an event that does not have any associated data, use the base type for event data, , and use as the event delegate. All that remains to do is to define an event member and a protected `On`*EventName* method that raises the event. + +For details about defining custom events, see [Events](/dotnet/standard/events/index). If you define an event that does not have any associated data, use the base type for event data, , and use as the event delegate. All that remains to do is to define an event member and a protected `On`*EventName* method that raises the event. The following code fragment shows how the `FlashTrackBar` custom control defines a custom event, `ValueChanged`. For the complete code for the `FlashTrackBar` sample, see the [How to: Create a Windows Forms Control That Shows Progress](how-to-create-a-windows-forms-control-that-shows-progress.md). @@ -73,4 +74,4 @@ public class FlashTrackBar : Control { ## See also - [Events in Windows Forms Controls](events-in-windows-forms-controls.md) -- [Events](https://docs.microsoft.com/dotnet/standard/events/index) +- [Events](/dotnet/standard/events/index) diff --git a/dotnet-desktop-guide/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md b/dotnet-desktop-guide/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md index db11dd0..3afeb65 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md @@ -169,7 +169,7 @@ Visual Studio attempted to wire up an event-handling method and could not find o The templates for inherited forms in Visual Studio are not available. If you see this error, please log an issue by using [Report a Problem](/visualstudio/ide/how-to-report-a-problem-with-visual-studio). -### Delegate class '\' has no invoke method. Is this class a delegate? +### Delegate class '\' has no invoke method. Is this class a delegate Visual Studio has tried to create an event handler, but there is something wrong with the event type. This can happen if the event was created by a non-CLS-compliant language. Contact the component vendor. @@ -209,7 +209,7 @@ You've tried to rename a component to an invalid value for that language. To cor ### The type '\' is made of several partial classes in the same file -When you define a class in multiple files by using the [partial](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/partial-type) keyword, you can only have one partial definition in each file. +When you define a class in multiple files by using the [partial](/dotnet/csharp/language-reference/keywords/partial-type) keyword, you can only have one partial definition in each file. To correct this error, remove all but one of the partial definitions of your class from the file. @@ -257,7 +257,7 @@ Visual Studio could not load the designer for the class. If you see this error, ### The designer must create an instance of type '\', but it can't because the type is declared as abstract -This error occurred because the base class of the object being passed to the designer is [abstract](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/abstract), which is not allowed. +This error occurred because the base class of the object being passed to the designer is [abstract](/dotnet/csharp/language-reference/keywords/abstract), which is not allowed. ### The file could not be loaded in the designer @@ -359,7 +359,7 @@ This message is similar to "The language for this file does not support the nece ### Type '\' does not have a constructor with parameters of types '\' -Visual Studio could not find a [constructor](https://docs.microsoft.com/dotnet/csharp/programming-guide/classes-and-structs/constructors) that had matching parameters. This may be the result of supplying a constructor with types other than those that are required. For example, a **Point** constructor might take two integers. If you provided floats, this error is raised. +Visual Studio could not find a [constructor](/dotnet/csharp/programming-guide/classes-and-structs/constructors) that had matching parameters. This may be the result of supplying a constructor with types other than those that are required. For example, a **Point** constructor might take two integers. If you provided floats, this error is raised. To correct this error, use a different constructor or explicitly cast the parameter types such that they match those provided by the constructor. diff --git a/dotnet-desktop-guide/framework/winforms/controls/developing-a-composite-windows-forms-control.md b/dotnet-desktop-guide/framework/winforms/controls/developing-a-composite-windows-forms-control.md index 81df46c..d029aa7 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/developing-a-composite-windows-forms-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/developing-a-composite-windows-forms-control.md @@ -42,7 +42,7 @@ The Windows Forms designer in Visual Studio provides rich design-time support fo - [Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features](creating-a-wf-control-design-time-features.md) -- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) +- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/developing-custom-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/developing-custom-windows-forms-controls.md index 4493925..5cbdc5a 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/developing-custom-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/developing-custom-windows-forms-controls.md @@ -8,9 +8,11 @@ helpviewer_keywords: ms.assetid: 236cebc0-bd71-4f18-9fd6-5d0e592375df --- # Developing Custom Windows Forms Controls with the .NET Framework + Windows Forms controls are reusable components that encapsulate user interface functionality and are used in client-side Windows-based applications. Not only does Windows Forms provide many ready-to-use controls, it also provides the infrastructure for developing your own controls. You can combine existing controls, extend existing controls, or author your own custom controls. This section provides background information and samples to help you develop Windows Forms controls. ## In This Section + [Overview of Using Controls in Windows Forms](overview-of-using-controls-in-windows-forms.md) Highlights the essential elements of using controls in Windows Forms applications. @@ -39,6 +41,7 @@ Windows Forms controls are reusable components that encapsulate user interface f Shows how to implement multithreaded controls. ## Reference + Describes this class and has links to all of its members. @@ -46,13 +49,14 @@ Windows Forms controls are reusable components that encapsulate user interface f Describes this class and has links to all of its members. ## Related Sections - [Design-Time Attributes for Components](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)) + + [Design-Time Attributes for Components](/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)) Lists metadata attributes to apply to components and controls so that they are displayed correctly at design time in visual designers. - [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) + [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) Describes how to implement classes such as editors and designers that provide design-time support. - [How to: License Components and Controls](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/fe8b1eh9(v=vs.120)) + [How to: License Components and Controls](/previous-versions/visualstudio/visual-studio-2013/fe8b1eh9(v=vs.120)) Describes how to implement licensing in your control or component. Also see [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md). diff --git a/dotnet-desktop-guide/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md b/dotnet-desktop-guide/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md index 70df820..e5e5fd2 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md +++ b/dotnet-desktop-guide/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md @@ -18,9 +18,9 @@ manager: jillfra For control authors, the .NET Framework provides a wealth of control authoring technology. Authors are no longer limited to designing composite controls that act as a collection of preexisting controls. Through inheritance, you can create your own controls from preexisting composite controls or preexisting Windows Forms controls. You can also design your own controls that implement custom painting. These options enable a great deal of flexibility to the design and functionality of the visual interface. To take advantage of these features, you should be familiar with object-based programming concepts. > [!NOTE] -> It is not necessary to have a thorough understanding of inheritance, but you may find it useful to refer to [Inheritance basics (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics). +> It is not necessary to have a thorough understanding of inheritance, but you may find it useful to refer to [Inheritance basics (Visual Basic)](/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics). -If you want to create custom controls to use on Web Forms, see [Developing Custom ASP.NET Server Controls](https://docs.microsoft.com/previous-versions/aspnet/zt27tfhy(v=vs.100)). +If you want to create custom controls to use on Web Forms, see [Developing Custom ASP.NET Server Controls](/previous-versions/aspnet/zt27tfhy(v=vs.100)). ## In this section @@ -86,7 +86,7 @@ Shows how to diagnose and fix common issues that can occur when you author a cus [Developing Custom Windows Forms Controls with the .NET Framework](developing-custom-windows-forms-controls.md)\ Discusses how to create your own custom controls with the .NET Framework. -[Language Independence and Language-Independent Components](https://docs.microsoft.com/dotnet/standard/language-independence-and-language-independent-components)\ +[Language Independence and Language-Independent Components](/dotnet/standard/language-independence-and-language-independent-components)\ Introduces the common language runtime, which is designed to simplify the creation and use of components. An important aspect of this simplification is enhanced interoperability between components written using different programming languages. The Common Language Specification (CLS) makes it possible to create tools and components that work with multiple programming languages. [Walkthrough: Automatically Populating the Toolbox with Custom Components](walkthrough-automatically-populating-the-toolbox-with-custom-components.md)\ diff --git a/dotnet-desktop-guide/framework/winforms/controls/events-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/events-in-windows-forms-controls.md index 6e3a650..2ee0298 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/events-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/events-in-windows-forms-controls.md @@ -7,13 +7,14 @@ helpviewer_keywords: ms.assetid: 7e3d1379-87aa-437c-afce-c99454eff30e --- # Events in Windows Forms Controls + A Windows Forms control inherits more than sixty events from . These include the event, which causes a control to be drawn, events related to displaying a window, such as the and events, and low-level mouse and keyboard events. Some low-level events are synthesized by into semantic events such as and . For details about inherited events, see . - If your custom control needs to override inherited event functionality, override the inherited `On`*EventName* method instead of attaching a delegate. If you are not familiar with the event model in the .NET Framework, see [Raising Events from a Component](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/sh2e3k5z(v=vs.120)). + If your custom control needs to override inherited event functionality, override the inherited `On`*EventName* method instead of attaching a delegate. If you are not familiar with the event model in the .NET Framework, see [Raising Events from a Component](/previous-versions/visualstudio/visual-studio-2013/sh2e3k5z(v=vs.120)). ## See also - [Overriding the OnPaint Method](overriding-the-onpaint-method.md) - [Handling User Input](handling-user-input.md) - [Defining an Event](defining-an-event-in-windows-forms-controls.md) -- [Events](https://docs.microsoft.com/dotnet/standard/events/index) +- [Events](/dotnet/standard/events/index) diff --git a/dotnet-desktop-guide/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md index 03daaf3..b54ceac 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md @@ -9,6 +9,7 @@ helpviewer_keywords: ms.assetid: 87412dd2-478f-4751-af87-dafc591fc215 --- # How to: Freeze Columns in the Windows Forms DataGridView Control Using the Designer + When users view data displayed in a Windows Forms control, they sometimes need to refer to a single column or set of columns frequently. For example, when you display a table of customer information that contains many columns, it is useful for you to display the customer name at all times while enabling other columns to scroll outside the visible region. To achieve this behavior, you can freeze columns in the control. When you freeze a column, all the columns to its left (or to its right in right-to-left language scripts) are frozen as well. Frozen columns remain in place while all other columns can scroll. If column reordering is enabled, the frozen columns are treated as a group distinct from the unfrozen columns. Users can reposition columns in either group, but they cannot move a column from one group to the other. @@ -32,6 +33,6 @@ When users view data displayed in a Windows Forms - [How to: Add and Remove Columns in the Windows Forms DataGridView Control Using the Designer](add-and-remove-columns-in-the-datagrid-using-the-designer.md) - [How to: Enable Column Reordering in the Windows Forms DataGridView Control Using the Designer](enable-column-reordering-in-the-datagrid-using-the-designer.md) -- [How to: Display Right-to-Left Text in Windows Forms for Globalization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7d3337xw(v=vs.100)) +- [How to: Display Right-to-Left Text in Windows Forms for Globalization](/previous-versions/visualstudio/visual-studio-2010/7d3337xw(v=vs.100)) - [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) - [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md b/dotnet-desktop-guide/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md index e85f2e2..ae74383 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md +++ b/dotnet-desktop-guide/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md @@ -13,21 +13,25 @@ helpviewer_keywords: ms.assetid: 9004e72f-fdec-4264-a37d-2c99764efc13 --- # How to: Handle Errors That Occur During Data Entry in the Windows Forms DataGridView Control + The following code example demonstrates how to use the control to report data entry errors to the user. For a complete explanation of this code example, see [Walkthrough: Handling Errors that Occur During Data Entry in the Windows Forms DataGridView Control](handling-errors-that-occur-during-data-entry-in-the-datagrid.md). ## Example + [!code-csharp[System.Windows.Forms.DataGridView.DataError#00](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.DataError/CS/errorhandling.cs#00)] [!code-vb[System.Windows.Forms.DataGridView.DataError#00](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.DataError/VB/errorhandling.vb#00)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Windows.Forms, and System.XML assemblies. ## .NET Framework Security - Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). + + Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). ## See also @@ -36,4 +40,4 @@ The following code example demonstrates how to use the object. Be sure that you set the `connectionString` variable to a value that is appropriate for your database. > [!IMPORTANT] - > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). + > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataGridView.DataError#30](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.DataError/CS/errorhandling.cs#30)] [!code-vb[System.Windows.Forms.DataGridView.DataError#30](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.DataError/VB/errorhandling.vb#30)] @@ -93,4 +93,4 @@ This application gives you a basic understanding of the . When handling an event, control authors should override the protected `On`*EventName* method rather than attaching a delegate to the event. For a review of events, see [Raising Events from a Component](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/sh2e3k5z(v=vs.120)). + +This topic describes the main keyboard and mouse events provided by . When handling an event, control authors should override the protected `On`*EventName* method rather than attaching a delegate to the event. For a review of events, see [Raising Events from a Component](/previous-versions/visualstudio/visual-studio-2013/sh2e3k5z(v=vs.120)). > [!NOTE] > If there is no data associated with an event, an instance of the base class is passed as an argument to the `On`*EventName* method. ## Keyboard Events + The common keyboard events that your control can handle are , , and . |Event Name|Method to Override|Description of Event| @@ -29,6 +31,7 @@ This topic describes the main keyboard and mouse events provided by Handling keyboard input is considerably more complex than overriding the events in the preceding table and is beyond the scope of this topic. For more information, see [User Input in Windows Forms](../user-input-in-windows-forms.md). ## Mouse Events + The mouse events that your control can handle are , , , , , and . |Event Name|Method to Override|Description of Event| @@ -61,5 +64,5 @@ This topic describes the main keyboard and mouse events provided by and properties on the control return the HTML of the current document as it existed when it was first displayed. However, if you modify the page using method and property calls such as and , these changes will not appear when you call and . To obtain the most up-to-date HTML source for the DOM, you must call the property on the HTML element. The following procedure shows how to retrieve the dynamic source and display it in a separate shortcut menu. @@ -29,7 +30,7 @@ The and control named `Button1` to your , and monitor for the event. For details on monitoring events, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). +6. Add a control named `Button1` to your , and monitor for the event. For details on monitoring events, see [Events](/dotnet/standard/events/index). 7. Add the following code to the event handler. @@ -37,6 +38,7 @@ The and before attempting to retrieve it. If the current page is not finished loading, or one or more of its child objects may not be initialized. ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md index 5ffa45c..95e46e8 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md @@ -10,6 +10,7 @@ helpviewer_keywords: ms.assetid: 40fa5cd5-1ed8-42f6-a93f-9ac01608bbeb --- # How to: Access the Managed HTML Document Object Model + You can access the managed HTML Document Object Model (DOM) from two types of applications: - A Windows Forms application (.exe) that hosted the managed control. These two technologies complement one another, with the control displaying the page to the user and the HTML DOM representing the document's logical structure. @@ -18,7 +19,7 @@ You can access the managed HTML Document Object Model (DOM) from two types of ap ### To access DOM from a Windows Forms application -1. Host a control within your Windows Forms application and monitor for the event. For details on hosting controls and monitoring for events, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). +1. Host a control within your Windows Forms application and monitor for the event. For details on hosting controls and monitoring for events, see [Events](/dotnet/standard/events/index). 2. Retrieve the for the current page by accessing the property of the control. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md index a8b6d26..a3b0a40 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md @@ -14,7 +14,7 @@ While the Windows Forms Designer in Visual Studio is optimized to host Windows F > [!CAUTION] > There are performance limitations for Windows Forms when ActiveX controls are added to them. -Before you add ActiveX controls to your form, you must add them to the Toolbox. For more information, see [COM Components, Customize Toolbox Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/cby6tzh5(v=vs.100)). +Before you add ActiveX controls to your form, you must add them to the Toolbox. For more information, see [COM Components, Customize Toolbox Dialog Box](/previous-versions/visualstudio/visual-studio-2010/cby6tzh5(v=vs.100)). ## Add an ActiveX control to your Windows Form @@ -23,12 +23,12 @@ To add an ActiveX control to your Windows Form, double-click the control on the Visual Studio adds all references to the control in your project. For more information about things to keep in mind when using ActiveX controls on Windows Forms, see [Considerations When Hosting an ActiveX Control on a Windows Form](considerations-when-hosting-an-activex-control-on-a-windows-form.md). > [!NOTE] -> The Windows Forms ActiveX Control Importer (AxImp.exe) creates event arguments of a different type than expected upon importation of ActiveX dynamic link libraries. The arguments created by AxImp.exe are similar to the following: `Invoke(object sender, DWebBrowserEvents2_ProgressChangeEvent e)`, when `Invoke(object sender, DWebBrowserEvents2_ProgressChangeEventArgs e)` is expected. Be aware that this irregularity does not prevent code from functioning normally. For details, see [Windows Forms ActiveX Control Importer (Aximp.exe)](https://docs.microsoft.com/dotnet/framework/tools/aximp-exe-windows-forms-activex-control-importer). +> The Windows Forms ActiveX Control Importer (AxImp.exe) creates event arguments of a different type than expected upon importation of ActiveX dynamic link libraries. The arguments created by AxImp.exe are similar to the following: `Invoke(object sender, DWebBrowserEvents2_ProgressChangeEvent e)`, when `Invoke(object sender, DWebBrowserEvents2_ProgressChangeEventArgs e)` is expected. Be aware that this irregularity does not prevent code from functioning normally. For details, see [Windows Forms ActiveX Control Importer (Aximp.exe)](/dotnet/framework/tools/aximp-exe-windows-forms-activex-control-importer). ## See also - [Windows Forms Controls](index.md) -- [Controls and Programmable Objects Compared in Various Languages and Libraries](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) +- [Controls and Programmable Objects Compared in Various Languages and Libraries](/previous-versions/visualstudio/visual-studio-2010/0061wezk(v=vs.100)) - [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md) - [Labeling Individual Windows Forms Controls and Providing Shortcuts to Them](labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them.md) - [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-to-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-to-windows-forms.md index 6fe2485..f8cafb7 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-to-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-to-windows-forms.md @@ -17,7 +17,7 @@ Most forms are designed by adding controls to the surface of the form to define ## To draw a control on a form -1. Open the form. For more information, see [How to: Display Windows Forms in the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). +1. Open the form. For more information, see [How to: Display Windows Forms in the Designer](/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). 2. In the **Toolbox**, click the control you want to add to your form. @@ -30,7 +30,7 @@ Most forms are designed by adding controls to the surface of the form to define ## To drag a control to a form -1. Open the form. For more information, see [How to: Display Windows Forms in the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). +1. Open the form. For more information, see [How to: Display Windows Forms in the Designer](/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). 2. In the **Toolbox**, click the control you want and drag it to your form. @@ -78,7 +78,6 @@ Most forms are designed by adding controls to the surface of the form to define > [!NOTE] > You can also add code to initialize other properties of the control. - > [!IMPORTANT] > You might expose your local computer to a security risk through the network by referencing a malicious `UserControl`. This would only be a concern in the case of a malicious person creating a damaging custom control, followed by you mistakenly adding it to your project. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md index ea8839b..eed4b31 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md @@ -21,13 +21,13 @@ A nonvisual control (or component) provides functionality to your application. U ## Add a component to a Windows Form -1. Open the form in Visual Studio. For details, see [How to: Display Windows Forms in the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). +1. Open the form in Visual Studio. For details, see [How to: Display Windows Forms in the Designer](/previous-versions/visualstudio/visual-studio-2010/w5yd62ts(v=vs.100)). 2. In the **Toolbox**, click a component and drag it to your form. Your component appears in the component tray. -Furthermore, components can be added to a form at run time. This is a common scenario, especially because components do not have a visual expression, unlike controls that have a user interface. In the example below, a component is added at run time. (Note that Visual Studio contains a number of different timers; in this case, use a Windows Forms component. For more information about the different timers in Visual Studio, see [Introduction to Server-Based Timers](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)).) +Furthermore, components can be added to a form at run time. This is a common scenario, especially because components do not have a visual expression, unlike controls that have a user interface. In the example below, a component is added at run time. (Note that Visual Studio contains a number of different timers; in this case, use a Windows Forms component. For more information about the different timers in Visual Studio, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)).) > [!CAUTION] > Components often have control-specific properties that must be set for the component to function effectively. In the case of the component below, you set the `Interval` property. Be sure, when adding components to your project, that you set the properties necessary for that component. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md index 10a1584..bcfa5ca 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: 835e3902-288c-4c38-9d69-0696d8695009 --- # How to: Add Panels to a StatusBar Control + > [!IMPORTANT] > The and controls replace and add functionality to the and controls; however, the and controls are retained for both backward compatibility and future use, if you choose. @@ -118,7 +119,7 @@ ms.assetid: 835e3902-288c-4c38-9d69-0696d8695009 - - -- [Collection Editor Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/xc4yyekt(v=vs.100)) +- [Collection Editor Dialog Box](/previous-versions/visualstudio/visual-studio-2010/xc4yyekt(v=vs.100)) - [How to: Set the Size of Status-Bar Panels](how-to-set-the-size-of-status-bar-panels.md) - [Walkthrough: Updating Status Bar Information at Run Time](walkthrough-updating-status-bar-information-at-run-time.md) - [How to: Determine Which Panel in the Windows Forms StatusBar Control Was Clicked](determine-which-panel-wf-statusbar-control-was-clicked.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md index 58b0c2b..0909051 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md @@ -15,6 +15,7 @@ helpviewer_keywords: ms.assetid: 771bf895-3d5f-469b-a324-3528f343657e --- # How to: Add to or Remove from a Collection of Controls at Run Time + Common tasks in application development are adding controls to and removing controls from any container control on your forms (such as the or control, or even the form itself). At design time, controls can be dragged directly onto a panel or group box. At run time, these controls maintain a `Controls` collection, which keeps track of what controls are placed on them. > [!NOTE] @@ -61,7 +62,7 @@ Common tasks in application development are adding controls to and removing cont ### To remove controls from a collection programmatically -1. Remove the event handler from the event. In Visual Basic, use the [RemoveHandler Statement](https://docs.microsoft.com/dotnet/visual-basic/language-reference/statements/removehandler-statement) keyword; in C#, use the [-= operator](https://docs.microsoft.com/dotnet/csharp/language-reference/operators/subtraction-operator). +1. Remove the event handler from the event. In Visual Basic, use the [RemoveHandler Statement](/dotnet/visual-basic/language-reference/statements/removehandler-statement) keyword; in C#, use the [-= operator](/dotnet/csharp/language-reference/operators/subtraction-operator). 2. Use the `Remove` method to delete the desired control from the panel's `Controls` collection. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md index 8ce3203..d36d0a6 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md @@ -11,9 +11,11 @@ helpviewer_keywords: ms.assetid: af0a3f7f-155b-4ba1-83c4-9cf721331a06 --- # How to: Apply Attributes in Windows Forms Controls + To develop components and controls that interact correctly with the design environment and execute correctly at run time, you need to apply attributes correctly to classes and members. ## Example + The following code example demonstrates how to use several attributes on a custom control. The control demonstrates a simple logging capability. When the control is bound to a data source, it displays the values sent by the data source in a control. If a value exceeds the value specified by the `Threshold` property, a `ThresholdExceeded` event is raised. The `AttributesDemoControl` logs values with a `LogEntry` class. The `LogEntry` class is a template class, which means it is parameterized on the type that it logs. For example, if the `AttributesDemoControl` is logging values of type `float`, each `LogEntry` instance is declared and used as follows. @@ -35,30 +37,35 @@ To develop components and controls that interact correctly with the design envir The first code example is the `AttributesDemoControl` implementation. The second code example demonstrates a form that uses the `AttributesDemoControl`. ## Class-level Attributes + Some attributes are applied at the class level. The following code example shows the attributes that are commonly applied to a Windows Forms control. [!code-csharp[System.ComponentModel.AttributesDemoControl#20](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/CS/attributesdemocontrol.cs#20)] [!code-vb[System.ComponentModel.AttributesDemoControl#20](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/VB/attributesdemocontrol.vb#20)] ### TypeConverter Attribute + is another commonly used class-level attribute. The following code example shows its use for the `LogEntry` class. This example also shows an implementation of a for the `LogEntry` type, called `LogEntryTypeConverter`. [!code-csharp[System.ComponentModel.AttributesDemoControl#5](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/CS/attributesdemocontrol.cs#5)] [!code-vb[System.ComponentModel.AttributesDemoControl#5](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/VB/attributesdemocontrol.vb#5)] ## Member-level Attributes + Some attributes are applied at the member level. The following code examples show some attributes that are commonly applied to properties of Windows Forms controls. [!code-csharp[System.ComponentModel.AttributesDemoControl#21](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/CS/attributesdemocontrol.cs#21)] [!code-vb[System.ComponentModel.AttributesDemoControl#21](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/VB/attributesdemocontrol.vb#21)] ### AmbientValue Attribute + The following example demonstrates the and shows code that supports its interaction with the design environment. This interaction is called *ambience*. [!code-csharp[System.ComponentModel.AttributesDemoControl#23](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/CS/attributesdemocontrol.cs#23)] [!code-vb[System.ComponentModel.AttributesDemoControl#23](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/VB/attributesdemocontrol.vb#23)] ### Databinding Attributes + The following examples demonstrate an implementation of complex data binding. The class-level , shown previously, specifies the `DataSource` and `DataMember` properties to use for data binding. The specifies the type to which the `DataSource` property will bind. [!code-csharp[System.ComponentModel.AttributesDemoControl#25](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.AttributesDemoControl/CS/attributesdemocontrol.cs#25)] @@ -77,4 +84,4 @@ To develop components and controls that interact correctly with the design envir - - [Developing Custom Windows Forms Controls with the .NET Framework](developing-custom-windows-forms-controls.md) - [Attributes in Windows Forms Controls](attributes-in-windows-forms-controls.md) -- [How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/ms171833(v=vs.120)) +- [How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute](/previous-versions/visualstudio/visual-studio-2013/ms171833(v=vs.120)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md index 2c9670d..9a9e1a4 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md @@ -29,13 +29,13 @@ This complete code example retrieves data from a database to populate a DataGrid This example requires: -- Access to a Northwind SQL Server sample database. For more information about installing the Northwind sample database, see [Get the sample databases for ADO.NET code samples](https://docs.microsoft.com/dotnet/framework/data/adonet/sql/linq/downloading-sample-databases). +- Access to a Northwind SQL Server sample database. For more information about installing the Northwind sample database, see [Get the sample databases for ADO.NET code samples](/dotnet/framework/data/adonet/sql/linq/downloading-sample-databases). - References to the System, System.Windows.Forms, System.Data, and System.Xml assemblies. -To build and run this example, paste the code into the *Form1* code file in a new Windows Forms project. For information about building from the C# or Visual Basic command line, see [Command-line building with csc.exe](https://docs.microsoft.com/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line](https://docs.microsoft.com/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). +To build and run this example, paste the code into the *Form1* code file in a new Windows Forms project. For information about building from the C# or Visual Basic command line, see [Command-line building with csc.exe](/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line](/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). -Populate the `connectionString` variable in the example with the values for your Northwind SQL Server sample database connection. Windows Authentication, also called integrated security, is a more secure way to connect to the database than storing a password in the connection string. For more information about connection security, see [Protect connection information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). +Populate the `connectionString` variable in the example with the values for your Northwind SQL Server sample database connection. Windows Authentication, also called integrated security, is a more secure way to connect to the database than storing a password in the connection string. For more information about connection security, see [Protect connection information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataGridViewBoundEditable](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewBoundEditable/CS/datagridviewboundeditable.cs)] [!code-vb[System.Windows.Forms.DataGridViewBoundEditable](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewBoundEditable/VB/datagridviewboundeditable.vb)] @@ -46,4 +46,4 @@ Populate the `connectionString` variable in the example with the values for your - - - [Display data in the Windows Forms DataGridView control](displaying-data-in-the-windows-forms-datagridview-control.md) -- [Protect connection information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information) +- [Protect connection information](/dotnet/framework/data/adonet/protecting-connection-information) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md index d44c890..57597fc 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md @@ -58,7 +58,7 @@ Often, within Windows applications you create, you will have to prompt users to ``` > [!IMPORTANT] - > To use this class, your assembly requires a privilege level granted by the property, which is part of the enumeration. If you are running in a partial-trust context, the process might throw an exception because of insufficient privileges. For more information, see [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). + > To use this class, your assembly requires a privilege level granted by the property, which is part of the enumeration. If you are running in a partial-trust context, the process might throw an exception because of insufficient privileges. For more information, see [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics). For information on how to save files, see [How to: Save Files Using the SaveFileDialog Component](how-to-save-files-using-the-savefiledialog-component.md). diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md index 1cb45c9..0dfc765 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md @@ -13,9 +13,11 @@ helpviewer_keywords: ms.assetid: babdf198-404c-485d-a914-ed370c6ecd99 --- # How to: Create a Resizable Windows Form for Data Entry -A good layout responds well to changes in the dimensions of its parent form. You can use the control to arrange the layout of your form to resize and position your controls in a consistent way as the form's dimensions change. The control is also useful when changes in the contents of your controls cause changes in the layout. The process covered in this procedure can be done within the Visual Studio environment. Also see [Walkthrough: Creating a Resizable Windows Form for Data Entry](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)). + +A good layout responds well to changes in the dimensions of its parent form. You can use the control to arrange the layout of your form to resize and position your controls in a consistent way as the form's dimensions change. The control is also useful when changes in the contents of your controls cause changes in the layout. The process covered in this procedure can be done within the Visual Studio environment. Also see [Walkthrough: Creating a Resizable Windows Form for Data Entry](/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)). ## Example + The following example demonstrates how to use a control to build a layout that responds well when the user resizes the form. It also demonstrates a layout that responds well to localization. [!code-cpp[System.Windows.Forms.TableLayoutPanel.DataEntryForm#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TableLayoutPanel.DataEntryForm/cpp/basicdataentryform.cpp#1)] @@ -23,6 +25,7 @@ A good layout responds well to changes in the dimensions of its parent form. You [!code-vb[System.Windows.Forms.TableLayoutPanel.DataEntryForm#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.TableLayoutPanel.DataEntryForm/VB/basicdataentryform.vb#1)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Drawing and System.Windows.Forms assemblies. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md index e192599..8e7ffc8 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: 24c5a2e3-058c-4b8d-a217-c06e6a130c2f --- # How to: Create a Windows Forms Control That Shows Progress + The following code example shows a custom control called `FlashTrackBar` that can be used to show the user the level or the progress of an application. It uses a gradient to visually represent progress. The `FlashTrackBar` control illustrates the following concepts: @@ -72,6 +73,7 @@ The following code example shows a custom control called `FlashTrackBar` that ca - ## Example + The `FlashTrackBar` control defines two UI type editors, `FlashTrackBarValueEditor` and `FlashTrackBarDarkenByEditor`, which are shown in the following code listings. The `HostApp` class uses the `FlashTrackBar` control on a Windows Form. [!code-csharp[System.Windows.Forms.FlashTrackBar#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FlashTrackBar/CS/FlashTrackBar.cs#1)] @@ -88,5 +90,5 @@ The following code example shows a custom control called `FlashTrackBar` that ca ## See also -- [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) +- [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) - [Windows Forms Control Development Basics](windows-forms-control-development-basics.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md index b675514..86c4ef5 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md @@ -12,12 +12,14 @@ helpviewer_keywords: ms.assetid: d13eff2d-701c-4b6e-8838-3885cbfb7223 --- # How to: Design a Windows Forms Layout that Responds Well to Localization + Creating forms that are ready to be localized greatly speeds development for international markets. You can use the control to implement layouts that respond gracefully as controls resize due to changes in their property values. ## Example - This form demonstrates how to create a layout that proportionally adjusts when you translate displayed string values into other languages. This process of translation is called *localization*. For more information, see [Localization](https://docs.microsoft.com/dotnet/standard/globalization-localization/localization). - There is extensive support for this task in Visual Studio. See also [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)). + This form demonstrates how to create a layout that proportionally adjusts when you translate displayed string values into other languages. This process of translation is called *localization*. For more information, see [Localization](/dotnet/standard/globalization-localization/localization). + + There is extensive support for this task in Visual Studio. See also [Walkthrough: Creating a Layout That Adjusts Proportion for Localization](/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)). [!code-csharp[System.Windows.Forms.TableLayoutPanel.LocalizableForm#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.TableLayoutPanel.LocalizableForm/CS/localizableform.cs#1)] [!code-vb[System.Windows.Forms.TableLayoutPanel.LocalizableForm#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.TableLayoutPanel.LocalizableForm/VB/localizableform.vb#1)] @@ -38,11 +40,12 @@ Creating forms that are ready to be localized greatly speeds development for int 7. [Walkthrough: Laying Out Windows Forms Controls with Padding, Margins, and the AutoSize Property](windows-forms-controls-padding-autosize.md) -8. [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/1zkt8b33(v=vs.100)) +8. [How to: Support Localization on Windows Forms Using AutoSize and the TableLayoutPanel Control](/previous-versions/visualstudio/visual-studio-2010/1zkt8b33(v=vs.100)) -9. [Walkthrough: Creating a Resizable Windows Form for Data Entry](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) +9. [Walkthrough: Creating a Resizable Windows Form for Data Entry](/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) ## Compiling the Code + This example requires: - References to the System, System.Data, System.Drawing and System.Windows.Forms assemblies. @@ -51,4 +54,4 @@ Creating forms that are ready to be localized greatly speeds development for int - - -- [Localization](https://docs.microsoft.com/dotnet/standard/globalization-localization/localization) +- [Localization](/dotnet/standard/globalization-localization/localization) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md index 5e6121e..306959e 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md @@ -29,7 +29,7 @@ This section walks you through the key steps for authoring a custom Windows Form public class FirstControl:Control {} ``` -2. Define properties. (You are not required to define properties, because a control inherits many properties from the class, but most custom controls generally do define additional properties.) The following code fragment defines a property named `TextAlignment` that `FirstControl` uses to format the display of the property inherited from . For more information about defining properties, see [Properties Overview](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/65zdfbdt(v%3dvs.120)). +2. Define properties. (You are not required to define properties, because a control inherits many properties from the class, but most custom controls generally do define additional properties.) The following code fragment defines a property named `TextAlignment` that `FirstControl` uses to format the display of the property inherited from . For more information about defining properties, see [Properties Overview](/previous-versions/visualstudio/visual-studio-2013/65zdfbdt(v%3dvs.120)). [!code-csharp[System.Windows.Forms.FirstControl#3](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/CS/FirstControl.cs#3)] [!code-vb[System.Windows.Forms.FirstControl#3](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/VB/FirstControl.vb#3)] @@ -41,12 +41,12 @@ This section walks you through the key steps for authoring a custom Windows Form [!code-csharp[System.Windows.Forms.FirstControl#4](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/CS/FirstControl.cs#4)] [!code-vb[System.Windows.Forms.FirstControl#4](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/VB/FirstControl.vb#4)] -4. Provide attributes for your control. Attributes enable a visual designer to display your control and its properties and events appropriately at design time. The following code fragment applies attributes to the `TextAlignment` property. In a designer such as Visual Studio, the attribute (shown in the code fragment) causes the property to be displayed under a logical category. The attribute causes a descriptive string to be displayed at the bottom of the **Properties** window when the `TextAlignment` property is selected. For more information about attributes, see [Design-Time Attributes for Components](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)). +4. Provide attributes for your control. Attributes enable a visual designer to display your control and its properties and events appropriately at design time. The following code fragment applies attributes to the `TextAlignment` property. In a designer such as Visual Studio, the attribute (shown in the code fragment) causes the property to be displayed under a logical category. The attribute causes a descriptive string to be displayed at the bottom of the **Properties** window when the `TextAlignment` property is selected. For more information about attributes, see [Design-Time Attributes for Components](/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)). [!code-csharp[System.Windows.Forms.FirstControl#5](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/CS/FirstControl.cs#5)] [!code-vb[System.Windows.Forms.FirstControl#5](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FirstControl/VB/FirstControl.vb#5)] -5. (optional) Provide resources for your control. You can provide a resource, such as a bitmap, for your control by using a compiler option (`/res` for C#) to package resources with your control. At run time, the resource can be retrieved using the methods of the class. For more information about creating and using resources, see the [Resources in Desktop Apps](https://docs.microsoft.com/dotnet/framework/resources/index). +5. (optional) Provide resources for your control. You can provide a resource, such as a bitmap, for your control by using a compiler option (`/res` for C#) to package resources with your control. At run time, the resource can be retrieved using the methods of the class. For more information about creating and using resources, see the [Resources in Desktop Apps](/dotnet/framework/resources/index). 6. Compile and deploy your control. To compile and deploy `FirstControl,` execute the following steps: @@ -62,7 +62,7 @@ This section walks you through the key steps for authoring a custom Windows Form csc -t:library -out:[path to your application's directory]/CustomWinControls.dll -r:System.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll FirstControl.cs ``` - The `/t:library` compiler option tells the compiler that the assembly you are creating is a library (and not an executable). The `/out` option specifies the path and name of the assembly. The`/r` option provides the name of the assemblies that are referenced by your code. In this example, you create a private assembly that only your applications can use. Hence, you have to save it in your application's directory. For more information about packaging and deploying a control for distribution, see [Deployment](https://docs.microsoft.com/dotnet/framework/deployment/index). + The `/t:library` compiler option tells the compiler that the assembly you are creating is a library (and not an executable). The `/out` option specifies the path and name of the assembly. The`/r` option provides the name of the assemblies that are referenced by your code. In this example, you create a private assembly that only your applications can use. Hence, you have to save it in your application's directory. For more information about packaging and deploying a control for distribution, see [Deployment](/dotnet/framework/deployment/index). The following sample shows the code for `FirstControl`. The control is enclosed in the namespace `CustomWinControls`. A namespace provides a logical grouping of related types. You can create your control in a new or existing namespace. In C#, the `using` declaration (in Visual Basic, `Imports`) allows types to be accessed from a namespace without using the fully qualified name of the type. In the following example, the `using` declaration allows code to access the class from as simply instead of having to use the fully qualified name . diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md index 824ee2d..0d3d968 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md @@ -18,7 +18,7 @@ As you develop and distribute controls, you may want those controls to appear in To display your control in the Choose Toolbox Items dialog box: -- Install your control assembly to the global assembly cache. For more information, see [How to: Install an Assembly into the Global Assembly Cache](https://docs.microsoft.com/dotnet/framework/app-domains/install-assembly-into-gac). +- Install your control assembly to the global assembly cache. For more information, see [How to: Install an Assembly into the Global Assembly Cache](/dotnet/framework/app-domains/install-assembly-into-gac). -or- @@ -27,5 +27,5 @@ To display your control in the Choose Toolbox Items dialog box: ## See also - [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md) -- [How to: Install an Assembly into the Global Assembly Cache](https://docs.microsoft.com/dotnet/framework/app-domains/install-assembly-into-gac) +- [How to: Install an Assembly into the Global Assembly Cache](/dotnet/framework/app-domains/install-assembly-into-gac) - [Walkthrough: Automatically Populating the Toolbox with Custom Components](walkthrough-automatically-populating-the-toolbox-with-custom-components.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md index 3069253..1db0236 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md @@ -28,7 +28,7 @@ The Windows Forms control can display We In the example below, the event opens an instance of Internet Explorer to the URL specified in the property of the control. This example assumes a form with a control. > [!IMPORTANT] - > In calling the method, you will encounter a exception if you are running the code in a partial-trust context because of insufficient privileges. For more information, see [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). + > In calling the method, you will encounter a exception if you are running the code in a partial-trust context because of insufficient privileges. For more information, see [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics). ```vb Public p As New System.Diagnostics.Process diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md index 331dd0a..bdd55ed 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md @@ -18,11 +18,12 @@ helpviewer_keywords: ms.assetid: 8c33543c-9c08-4636-a65a-fdf714a529b7 --- # How to: Format Data in the Windows Forms DataGridView Control + The following procedures demonstrate basic formatting of cell values using the property of a control and of specific columns in a control. For information about advanced data formatting, see [How to: Customize Data Formatting in the Windows Forms DataGridView Control](how-to-customize-data-formatting-in-the-windows-forms-datagridview-control.md). ### To format currency and date values -- Set the property of a . The following code example sets the format for specific columns using the property of the columns. Values in the `UnitPrice` column appear in the current culture-specific currency format, with negative values surrounded by parentheses. Values in the `ShipDate` column appear in the current culture-specific short date format. For more information about values, see [Formatting Types](https://docs.microsoft.com/dotnet/standard/base-types/formatting-types). +- Set the property of a . The following code example sets the format for specific columns using the property of the columns. Values in the `UnitPrice` column appear in the current culture-specific currency format, with negative values surrounded by parentheses. Values in the `ShipDate` column appear in the current culture-specific short date format. For more information about values, see [Formatting Types](/dotnet/standard/base-types/formatting-types). [!code-csharp[System.Windows.Forms.DataGridViewMisc#071](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/CS/datagridviewmisc.cs#071)] [!code-vb[System.Windows.Forms.DataGridViewMisc#071](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/VB/datagridviewmisc.vb#071)] @@ -49,10 +50,12 @@ The following procedures demonstrate basic formatting of cell values using the < [!code-vb[System.Windows.Forms.DataGridViewMisc#072](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/VB/datagridviewmisc.vb#072)] ## Example + [!code-csharp[System.Windows.Forms.DataGridViewMisc#070](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/CS/datagridviewmisc.cs#070)] [!code-vb[System.Windows.Forms.DataGridViewMisc#070](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/VB/datagridviewmisc.vb#070)] ## Compiling the Code + These examples require: - A control named `dataGridView1` that contains a column named `UnitPrice`, a column named `ShipDate`, and a column named `CustomerName`. @@ -60,6 +63,7 @@ The following procedures demonstrate basic formatting of cell values using the < - References to the , , and assemblies. ## Robust Programming + For maximum scalability, you should share objects across multiple rows, columns, or cells that use the same styles rather than setting the style properties for each element separately. For more information, see [Best Practices for Scaling the Windows Forms DataGridView Control](best-practices-for-scaling-the-windows-forms-datagridview-control.md). ## See also @@ -71,4 +75,4 @@ The following procedures demonstrate basic formatting of cell values using the < - [Cell Styles in the Windows Forms DataGridView Control](cell-styles-in-the-windows-forms-datagridview-control.md) - [Data Formatting in the Windows Forms DataGridView Control](data-formatting-in-the-windows-forms-datagridview-control.md) - [How to: Customize Data Formatting in the Windows Forms DataGridView Control](how-to-customize-data-formatting-in-the-windows-forms-datagridview-control.md) -- [Formatting Types](https://docs.microsoft.com/dotnet/standard/base-types/formatting-types) +- [Formatting Types](/dotnet/standard/base-types/formatting-types) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md index 9880f0a..fbb5810 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md @@ -27,7 +27,7 @@ There are three basic aspects of formatting the itself. These color and format choices form a base from which you can then make changes depending on the data tables and columns displayed. -The following procedure requires a **Windows Application** project with a form containing a control. For information about setting up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For more information, see [How to: Add Items to the Toolbox](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). +The following procedure requires a **Windows Application** project with a form containing a control. For information about setting up such a project, see [How to: Create a Windows Forms application project](/visualstudio/ide/step-1-create-a-windows-forms-application-project) and [How to: Add Controls to Windows Forms](how-to-add-controls-to-windows-forms.md). In Visual Studio 2005, the control is not in the **Toolbox** by default. For more information, see [How to: Add Items to the Toolbox](/previous-versions/visualstudio/visual-studio-2010/ms165355(v=vs.100)). ### To establish a default style for the DataGrid control @@ -87,7 +87,7 @@ The following procedure requires a **Windows Application** project with a form c With the **DataGridColumnStyle Collection Editor**, you can add and remove column styles, set display and layout properties, and set the mapping name and formatting strings for the data columns. > [!NOTE] - > For more information about formatting strings, see [Formatting Types](https://docs.microsoft.com/dotnet/standard/base-types/formatting-types). + > For more information about formatting strings, see [Formatting Types](/dotnet/standard/base-types/formatting-types). ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md index 5e4ca26..7c0e787 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md @@ -19,6 +19,7 @@ helpviewer_keywords: ms.assetid: 9f483f93-1613-4be1-a021-b4934e9c78f3 --- # How to: Implement a Form That Uses a Background Operation + The following example program creates a form that calculates Fibonacci numbers. The calculation runs on a thread that is separate from the user interface thread, so the user interface continues to run without delays as the calculation proceeds. There is extensive support for this task in Visual Studio. @@ -26,11 +27,13 @@ The following example program creates a form that calculates Fibonacci numbers. Also see [Walkthrough: Implementing a Form That Uses a Background Operation](walkthrough-implementing-a-form-that-uses-a-background-operation.md). ## Example + [!code-cpp[System.ComponentModel.BackgroundWorker#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp#1)] [!code-csharp[System.ComponentModel.BackgroundWorker#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CS/fibonacciform.cs#1)] [!code-vb[System.ComponentModel.BackgroundWorker#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/VB/fibonacciform.vb#1)] ## Compiling the Code + This example requires: - References to the System, System.Drawing, and System.Windows.Forms assemblies. @@ -38,11 +41,11 @@ The following example program creates a form that calculates Fibonacci numbers. ## Robust Programming > [!CAUTION] -> When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. +> When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. ## See also - - -- [Event-based Asynchronous Pattern Overview](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) -- [Managed Threading Best Practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices) +- [Event-based Asynchronous Pattern Overview](/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) +- [Managed Threading Best Practices](/dotnet/standard/threading/managed-threading-best-practices) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md index 36d4102..bca56e5 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md @@ -85,5 +85,5 @@ If you want to extend the functionality of an existing control, you can create a - [How to: Inherit from the Control Class](how-to-inherit-from-the-control-class.md) - [How to: Inherit from the UserControl Class](how-to-inherit-from-the-usercontrol-class.md) - [How to: Author Controls for Windows Forms](how-to-author-controls-for-windows-forms.md) -- [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) +- [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) - [Walkthrough: Inheriting from a Windows Forms Control](walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-control-class.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-control-class.md index 2cfcde7..6d30303 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-control-class.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-control-class.md @@ -44,5 +44,5 @@ If you want to create a completely custom control to use on a Windows Form, you - [How to: Inherit from the UserControl Class](how-to-inherit-from-the-usercontrol-class.md) - [How to: Inherit from Existing Windows Forms Controls](how-to-inherit-from-existing-windows-forms-controls.md) - [How to: Author Controls for Windows Forms](how-to-author-controls-for-windows-forms.md) -- [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) +- [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) - [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md index ed77e31..50b3c4f 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md @@ -35,5 +35,5 @@ To combine the functionality of one or more Windows Forms controls with custom c - [How to: Inherit from the Control Class](how-to-inherit-from-the-control-class.md) - [How to: Inherit from Existing Windows Forms Controls](how-to-inherit-from-existing-windows-forms-controls.md) - [How to: Author Controls for Windows Forms](how-to-author-controls-for-windows-forms.md) -- [Troubleshoot Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) +- [Troubleshoot Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) - [How to: Test the Run-Time Behavior of a UserControl](how-to-test-the-run-time-behavior-of-a-usercontrol.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md index a9dafba..d561fd1 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: 427f8928-ebcf-4beb-887f-695b905d5134 --- # How to: Iterate Through All Nodes of a Windows Forms TreeView Control + It is sometimes useful to examine every node in a Windows Forms control in order to perform some calculation on the node values. This operation can be done using a recursive procedure (recursive method in C# and C++) that iterates through each node in each collection of the tree. Each object in a tree view has properties that you can use to navigate the tree view: , , , , and . The value of the property is the parent node of the current node. The child nodes of the current node, if there are any, are listed in its property. The control itself has the property, which is the root node of the entire tree view. @@ -120,4 +121,4 @@ It is sometimes useful to examine every node in a Windows Forms control can display a ``` > [!IMPORTANT] - > To run this process, your assembly may require a privilege level granted by the class. If you are running in a partial-trust context, the process might throw an exception because of insufficient privileges. For more information, see [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). + > To run this process, your assembly may require a privilege level granted by the class. If you are running in a partial-trust context, the process might throw an exception because of insufficient privileges. For more information, see [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics). ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md index a978135..89ecc62 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md @@ -19,7 +19,7 @@ ms.assetid: 138f38b6-1099-4fd5-910c-390b41cbad35 --- # How to: Make thread-safe calls to Windows Forms controls -Multithreading can improve the performance of Windows Forms apps, but access to Windows Forms controls isn't inherently thread-safe. Multithreading can expose your code to very serious and complex bugs. Two or more threads manipulating a control can force the control into an inconsistent state and lead to race conditions, deadlocks, and freezes or hangs. If you implement multithreading in your app, be sure to call cross-thread controls in a thread-safe way. For more information, see [Managed threading best practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices). +Multithreading can improve the performance of Windows Forms apps, but access to Windows Forms controls isn't inherently thread-safe. Multithreading can expose your code to very serious and complex bugs. Two or more threads manipulating a control can force the control into an inconsistent state and lead to race conditions, deadlocks, and freezes or hangs. If you implement multithreading in your app, be sure to call cross-thread controls in a thread-safe way. For more information, see [Managed threading best practices](/dotnet/standard/threading/managed-threading-best-practices). There are two ways to safely call a Windows Forms control from a thread that didn't create that control. You can use the method to call a delegate created in the main thread, which in turn calls the control. Or, you can implement a , which uses an event-driven model to separate work done in the background thread from reporting on the results. @@ -61,7 +61,7 @@ The following code examples demonstrate two ways to safely call a Windows Forms In both examples, the background thread sleeps for one second to simulate work being done in that thread. -You can build and run these examples as .NET Framework apps from the C# or Visual Basic command line. For more information, see [Command-line building with csc.exe](https://docs.microsoft.com/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). +You can build and run these examples as .NET Framework apps from the C# or Visual Basic command line. For more information, see [Command-line building with csc.exe](/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line (Visual Basic)](/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). Starting with .NET Core 3.0, you can also build and run the examples as Windows .NET Core apps from a folder that has a .NET Core Windows Forms *\.csproj* project file. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md index 6659dea..e46d5d5 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md @@ -15,9 +15,9 @@ ms.assetid: 9d88367a-cc21-4ffd-be74-89fd63767d35 The component opens the Windows dialog box for browsing and selecting files. To open and read the selected files, you can use the method, or create an instance of the class. The following examples show both approaches. -In .NET Framework, to get or set the property requires a privilege level granted by the class. The examples run a permission check, and can throw an exception due to insufficient privileges if run in a partial-trust context. For more information, see [Code access security basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). +In .NET Framework, to get or set the property requires a privilege level granted by the class. The examples run a permission check, and can throw an exception due to insufficient privileges if run in a partial-trust context. For more information, see [Code access security basics](/dotnet/framework/misc/code-access-security-basics). -You can build and run these examples as .NET Framework apps from the C# or Visual Basic command line. For more information, see [Command-line building with csc.exe](https://docs.microsoft.com/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line](https://docs.microsoft.com/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). +You can build and run these examples as .NET Framework apps from the C# or Visual Basic command line. For more information, see [Command-line building with csc.exe](/dotnet/csharp/language-reference/compiler-options/command-line-building-with-csc-exe) or [Build from the command line](/dotnet/visual-basic/reference/command-line-compiler/building-from-the-command-line). Starting with .NET Core 3.0, you can also build and run the examples as Windows .NET Core apps from a folder that has a .NET Core Windows Forms *\.csproj* project file. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-position-controls-on-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-position-controls-on-windows-forms.md index a248533..3d820e3 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-position-controls-on-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-position-controls-on-windows-forms.md @@ -100,4 +100,4 @@ button1->Left += 200; - [Labeling Individual Windows Forms Controls and Providing Shortcuts to Them](labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them.md) - [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) - [Windows Forms Controls by Function](windows-forms-controls-by-function.md) -- [How to: Set the Screen Location of Windows Forms](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/52aha046(v=vs.100)) +- [How to: Set the Screen Location of Windows Forms](/previous-versions/visualstudio/visual-studio-2010/52aha046(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md index 6bb945b..badd288 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md @@ -15,7 +15,7 @@ manager: jillfra --- # How to: Provide a Toolbox Bitmap for a Control -If you want to have a special icon for your control appear in the **Toolbox** of Visual Studio, you can specify a particular image by using the . This class is an *attribute*, a special kind of class you can attach to other classes. For more information about attributes, see [Attributes overview (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/concepts/attributes/index) for Visual Basic or [Attributes (C#)](https://docs.microsoft.com/dotnet/csharp/programming-guide/concepts/attributes/index) for C#. +If you want to have a special icon for your control appear in the **Toolbox** of Visual Studio, you can specify a particular image by using the . This class is an *attribute*, a special kind of class you can attach to other classes. For more information about attributes, see [Attributes overview (Visual Basic)](/dotnet/visual-basic/programming-guide/concepts/attributes/index) for Visual Basic or [Attributes (C#)](/dotnet/csharp/programming-guide/concepts/attributes/index) for C#. Using the , you can specify a string that indicates the path and file name for a 16 by 16 pixel bitmap. This bitmap then appears next to your control when added to the **Toolbox**. You can also specify a , in which case the bitmap associated with that type is loaded. If you specify both a and a string, the control searches for an image resource with the name specified by the string parameter in the assembly containing the type specified by the parameter. @@ -66,5 +66,5 @@ Using the , you can specify a string - - [Walkthrough: Automatically Populating the Toolbox with Custom Components](walkthrough-automatically-populating-the-toolbox-with-custom-components.md) - [Developing Windows Forms Controls at Design Time](developing-windows-forms-controls-at-design-time.md) -- [Attributes overview (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/concepts/attributes/index) -- [Attributes (C#)](https://docs.microsoft.com/dotnet/csharp/programming-guide/concepts/attributes/index) +- [Attributes overview (Visual Basic)](/dotnet/visual-basic/programming-guide/concepts/attributes/index) +- [Attributes (C#)](/dotnet/csharp/programming-guide/concepts/attributes/index) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md index 0ad6e03..d0298c0 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md @@ -36,4 +36,4 @@ In Visual Studio, select the control to be resized and drag one of the eight siz - [Labeling Individual Windows Forms Controls and Providing Shortcuts to Them](labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them.md) - [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) - [Windows Forms Controls by Function](windows-forms-controls-by-function.md) -- [How to: Resize Windows Forms Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/37k2zkwx(v=vs.100)) +- [How to: Resize Windows Forms Using the Designer](/previous-versions/visualstudio/visual-studio-2010/37k2zkwx(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md index ce3fe8f..18aa636 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md @@ -28,7 +28,7 @@ The component allows users to browse In the example below, there is a control with an image assigned to it. When you click the button, a component is instantiated with a filter that allows files of type .gif, .jpeg, and .bmp. If a file of this type is selected in the Save File dialog box, the button's image is saved. > [!IMPORTANT] - > To get or set the property, your assembly requires a privilege level granted by the class. If you are running in a partial-trust context, the process might throw an exception due to insufficient privileges. For more information, see [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). + > To get or set the property, your assembly requires a privilege level granted by the class. If you are running in a partial-trust context, the process might throw an exception due to insufficient privileges. For more information, see [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics). The example assumes your form has a control with its property set to a file of type .gif, .jpeg, or .bmp. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md index 02f050a..413cc51 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md @@ -15,6 +15,7 @@ helpviewer_keywords: ms.assetid: 18ca41d0-68a5-4660-985e-a6c1fbc01d76 --- # How to: Set Pictures at Run Time (Windows Forms) + You can programmatically set the image displayed by a Windows Forms control. ### To set a picture programmatically @@ -87,7 +88,7 @@ You can programmatically set the image displayed by a Windows Forms [!NOTE] - > For more information on why you should use the method in this way, see [Cleaning Up Unmanaged Resources](https://docs.microsoft.com/dotnet/standard/garbage-collection/unmanage). + > For more information on why you should use the method in this way, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanage). This code will clear the image even if a graphic was loaded into the control at design time. diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md index ca6172d..5893ff1 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md @@ -18,7 +18,6 @@ When you develop a , you need to test its > [!IMPORTANT] > For the test container to load your , the control must have at least one public constructor. - > [!NOTE] > A Visual C++ control cannot be tested using the **UserControl Test Container**. @@ -65,4 +64,4 @@ You can test user controls from other projects in your current project's test co - - [How to: Author Composite Controls](how-to-author-composite-controls.md) - [Walkthrough: Authoring a Composite Control](walkthrough-authoring-a-composite-control-with-visual-csharp.md) -- [User Control Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/183c3hth(v=vs.100)) +- [User Control Designer](/previous-versions/visualstudio/visual-studio-2010/183c3hth(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md index 0dcaa8b..17a2362 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md @@ -12,9 +12,10 @@ helpviewer_keywords: ms.assetid: 7fe3956f-5b8f-4f78-8aae-c9eb0b28f13a --- # How to: Use a Background Thread to Search for Files + The component replaces and adds functionality to the namespace; however, the namespace is retained for both backward compatibility and future use, if you choose. For more information, see [BackgroundWorker Component Overview](backgroundworker-component-overview.md). - Windows Forms uses the single-threaded apartment (STA) model because Windows Forms is based on native Win32 windows that are inherently apartment-threaded. The STA model implies that a window can be created on any thread, but it cannot switch threads once created, and all function calls to it must occur on its creation thread. Outside Windows Forms, classes in the .NET Framework use the free threading model. For information about threading in the .NET Framework, see [Threading](https://docs.microsoft.com/dotnet/standard/threading/index). + Windows Forms uses the single-threaded apartment (STA) model because Windows Forms is based on native Win32 windows that are inherently apartment-threaded. The STA model implies that a window can be created on any thread, but it cannot switch threads once created, and all function calls to it must occur on its creation thread. Outside Windows Forms, classes in the .NET Framework use the free threading model. For information about threading in the .NET Framework, see [Threading](/dotnet/standard/threading/index). The STA model requires that any methods on a control that need to be called from outside the control's creation thread must be marshaled to (executed on) the control's creation thread. The base class provides several methods (, , and ) for this purpose. makes synchronous method calls; makes asynchronous method calls. @@ -563,6 +564,7 @@ namespace Microsoft.Samples.DirectorySearcher ``` ## Using the Multithreaded Control on a Form + The following example shows how the multithreaded `DirectorySearcher` control can be used on a form. ```vb @@ -758,4 +760,4 @@ namespace SampleUsage - - [Developing Custom Windows Forms Controls with the .NET Framework](developing-custom-windows-forms-controls.md) -- [Event-based Asynchronous Pattern Overview](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) +- [Event-based Asynchronous Pattern Overview](/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) diff --git a/dotnet-desktop-guide/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md b/dotnet-desktop-guide/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md index 85da98b..41c89a7 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md @@ -12,21 +12,25 @@ helpviewer_keywords: ms.assetid: d10aef35-701e-4a3c-a684-2a2ed1aeaca6 --- # How to: Validate Data in the Windows Forms DataGridView Control + The following code example demonstrates how to validate data entered by a user into a control. In this example, the is populated with rows from the `Customers` table of the Northwind sample database. When the user edits a cell in the `CompanyName` column, its value is tested for validity by checking that it is not empty. If the event handler for the event finds that the value is an empty string, the prevents the user from exiting the cell until a non-empty string is entered. For a complete explanation of this code example, see [Walkthrough: Validating Data in the Windows Forms DataGridView Control](walkthrough-validating-data-in-the-windows-forms-datagridview-control.md). ## Example + [!code-csharp[System.Windows.Forms.DataGridViewDataValidation#00](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewDataValidation/CS/datavalidation.cs#00)] [!code-vb[System.Windows.Forms.DataGridViewDataValidation#00](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewDataValidation/VB/datavalidation.vb#00)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Windows.Forms and System.XML assemblies. ## .NET Framework Security - Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). + + Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). ## See also @@ -35,4 +39,4 @@ The following code example demonstrates how to validate data entered by a user i - [Walkthrough: Validating Data in the Windows Forms DataGridView Control](walkthrough-validating-data-in-the-windows-forms-datagridview-control.md) - [Data Entry in the Windows Forms DataGridView Control](data-entry-in-the-windows-forms-datagridview-control.md) - [Walkthrough: Handling Errors that Occur During Data Entry in the Windows Forms DataGridView Control](handling-errors-that-occur-during-data-entry-in-the-datagrid.md) -- [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information) +- [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information) diff --git a/dotnet-desktop-guide/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md b/dotnet-desktop-guide/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md index 4fb5ad3..8c6f130 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md +++ b/dotnet-desktop-guide/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md @@ -14,6 +14,7 @@ helpviewer_keywords: ms.assetid: c2a052b9-423c-4ff7-91dc-d8c7c79345f6 --- # Implementing Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control + One reason to implement virtual mode in the control is to retrieve data only as it is needed. This is called *just-in-time data loading*. If you are working with a very large table in a remote database, for example, you might want to avoid startup delays by retrieving only the data that is necessary for display and retrieving additional data only when the user scrolls new rows into view. If the client computers running your application have a limited amount of memory available for storing data, you might also want to discard unused data when retrieving new values from the database. @@ -23,17 +24,19 @@ One reason to implement virtual mode in the control that interacts with a `Cache` object through a event handler. The `Cache` object manages the locally stored values and uses a `DataRetriever` object to retrieve values from the Orders table of the sample Northwind database. The `DataRetriever` object, which implements the `IDataPageRetriever` interface required by the `Cache` class, is also used to initialize the control rows and columns. The `IDataPageRetriever`, `DataRetriever`, and `Cache` types are described later in this topic. > [!NOTE] -> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). +> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataGridView.Virtual_lazyloading#100](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/CS/lazyloading.cs#100)] [!code-vb[System.Windows.Forms.DataGridView.Virtual_lazyloading#100](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/VB/lazyloading.vb#100)] ## The IDataPageRetriever Interface + The following code example defines the `IDataPageRetriever` interface, which is implemented by the `DataRetriever` class. The only method declared in this interface is the `SupplyPageOfData` method, which requires an initial row index and a count of the number of rows in a single page of data. These values are used by the implementer to retrieve a subset of data from a data source. A `Cache` object uses an implementation of this interface during construction to load two initial pages of data. Whenever an uncached value is needed, the cache discards one of these pages and requests a new page containing the value from the `IDataPageRetriever`. @@ -42,12 +45,14 @@ One reason to implement virtual mode in the control uses to create the necessary columns and to add the appropriate number of empty rows to the collection. Adding the empty rows is necessary so that the control will behave as though it contains all the data in the table. This means that the scroll box in the scroll bar will have the appropriate size, and the user will be able to access any row in the table. The rows are filled by the event handler only when they are scrolled into view. [!code-csharp[System.Windows.Forms.DataGridView.Virtual_lazyloading#200](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/CS/lazyloading.cs#200)] [!code-vb[System.Windows.Forms.DataGridView.Virtual_lazyloading#200](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/VB/lazyloading.vb#200)] ## The Cache Class + The following code example defines the `Cache` class, which manages two pages of data populated through an `IDataPageRetriever` implementation. The `Cache` class defines an inner `DataPage` structure, which contains a to store the values in a single cache page and which calculates the row indexes that represent the upper and lower boundaries of the page. The `Cache` class loads two pages of data at construction time. Whenever the event requests a value, the `Cache` object determines if the value is available in one of its two pages and, if so, returns it. If the value is not available locally, the `Cache` object determines which of its two pages is farthest from the currently displayed rows and replaces the page with a new one containing the requested value, which it then returns. @@ -58,6 +63,7 @@ One reason to implement virtual mode in the control. For best results, you will need to conduct performance testing and usability testing to determine the requirements of your system and your users. Several factors that you will need to take into consideration include the amount of memory in the client machines running your application, the available bandwidth of the network connection used, and the latency of the server used. The bandwidth and latency should be determined at times of peak usage. diff --git a/dotnet-desktop-guide/framework/winforms/controls/index.md b/dotnet-desktop-guide/framework/winforms/controls/index.md index b733cbd..a7bf290 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/index.md +++ b/dotnet-desktop-guide/framework/winforms/controls/index.md @@ -34,5 +34,5 @@ Describes techniques for creating custom controls through design and inheritance ## Related sections -[Client Applications](https://docs.microsoft.com/dotnet/framework/develop-client-apps)\ +[Client Applications](/dotnet/framework/develop-client-apps)\ Provides an overview of developing Windows-based applications. diff --git a/dotnet-desktop-guide/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md b/dotnet-desktop-guide/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md index 520e2ae..cba4994 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md +++ b/dotnet-desktop-guide/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md @@ -9,11 +9,13 @@ helpviewer_keywords: ms.assetid: 7e5fb513-77e7-4046-a8e8-aab94e61ca0f --- # Limitations of the Windows Forms Timer Component's Interval Property + The Windows Forms component has an property that specifies the number of milliseconds that pass between one timer event and the next. Unless the component is disabled, a timer continues to receive the event at roughly equal intervals of time. - This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). + This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). ## The Interval Property + The property has a few limitations to consider when you are programming a component: - If your application or another application is making heavy demands on the system — such as long loops, intensive calculations, or drive, network, or port access — your application may not get timer events as often as the property specifies. diff --git a/dotnet-desktop-guide/framework/winforms/controls/menustrip-control-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/menustrip-control-windows-forms.md index 16a9d55..6a9359b 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/menustrip-control-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/menustrip-control-windows-forms.md @@ -7,9 +7,11 @@ helpviewer_keywords: ms.assetid: e361bf98-eed8-4ed3-9dfb-5a2e865e3ce6 --- # MenuStrip Control (Windows Forms) + This control groups application commands and makes them easily accessible. ## In This Section + [MenuStrip Control Overview](menustrip-control-overview-windows-forms.md) Explains what the control is and its key features and properties. @@ -49,7 +51,7 @@ This control groups application commands and makes them easily accessible. [How to: Set Up Automatic Menu Merging for MDI Applications](how-to-set-up-automatic-menu-merging-for-mdi-applications.md) Describes how to merge menu items automatically at run time. -- [MenuStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233625(v=vs.100)) +- [MenuStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233625(v=vs.100)) - [How to: Copy ToolStripMenuItems](how-to-copy-toolstripmenuitems.md) @@ -61,9 +63,10 @@ This control groups application commands and makes them easily accessible. - [Walkthrough: Providing Standard Menu Items to a Form](walkthrough-providing-standard-menu-items-to-a-form.md) -- [MenuStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233645(v=vs.100)) +- [MenuStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233645(v=vs.100)) ## Reference + Describes the features of the class, which provides a menu system for a form. @@ -74,5 +77,6 @@ This control groups application commands and makes them easily accessible. Describes the features of the class, which represents a selectable option displayed on a or . ## Related Sections + [Controls to Use on Windows Forms](controls-to-use-on-windows-forms.md) Provides a complete list of Windows Forms controls, with links to information on their use. diff --git a/dotnet-desktop-guide/framework/winforms/controls/method-implementation-in-custom-controls.md b/dotnet-desktop-guide/framework/winforms/controls/method-implementation-in-custom-controls.md index 388ed24..21973ac 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/method-implementation-in-custom-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/method-implementation-in-custom-controls.md @@ -13,6 +13,7 @@ helpviewer_keywords: ms.assetid: 35d14fca-4bb4-4a27-8211-1f7a98ea27de --- # Method Implementation in Custom Controls + A method is implemented in a control in the same manner a method would be implemented in any other component. In Visual Basic, if a method is required to return a value, it is implemented as a `Public Function`. If no value is returned, it is implemented as a `Public Sub`. Methods are declared using the following syntax: @@ -39,6 +40,7 @@ public int ConvertMatterToEnergy(int matter) Typed arguments allow many developer errors to be caught by the compiler, rather than at run time. The compiler always catches errors, whereas run-time testing is only as good as the test suite. ## Overloaded Methods + If you want to allow users of your control to supply different combinations of parameters to a method, provide multiple overloads of the method, using explicit data types. Avoid creating parameters declared `As Object` that can contain any data type, as this can lead to errors that might not be caught in testing. > [!NOTE] @@ -71,5 +73,5 @@ public void Spin(Widget driver) ## See also -- [Events](https://docs.microsoft.com/dotnet/standard/events/index) +- [Events](/dotnet/standard/events/index) - [Properties in Windows Forms Controls](properties-in-windows-forms-controls.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md b/dotnet-desktop-guide/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md index cc8a003..82198fc 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md @@ -11,18 +11,21 @@ helpviewer_keywords: ms.assetid: 146d97be-3d97-400e-accb-860bbf47729d --- # How to: Move Through a DataSet with the Windows Forms BindingNavigator Control + As you build data-driven applications, you will often need to display collections of data to users. The control, in conjunction with the component, provides a convenient and extensible solution for moving through a collection and displaying items sequentially. ## Example + The following code example demonstrates how to use a control to move through data. The set is contained in a , which is bound to a control with a component. > [!NOTE] -> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). +> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataNavigator#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataNavigator/CS/form1.cs#1)] [!code-vb[System.Windows.Forms.DataNavigator#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataNavigator/VB/form1.vb#1)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Drawing, System.Windows.Forms and System.Xml assemblies. diff --git a/dotnet-desktop-guide/framework/winforms/controls/overriding-the-onpaint-method.md b/dotnet-desktop-guide/framework/winforms/controls/overriding-the-onpaint-method.md index 15792c6..09ee021 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/overriding-the-onpaint-method.md +++ b/dotnet-desktop-guide/framework/winforms/controls/overriding-the-onpaint-method.md @@ -10,6 +10,7 @@ helpviewer_keywords: ms.assetid: e9ca2723-0107-4540-bb21-4f5ffb4a9906 --- # Overriding the OnPaint Method + The basic steps for overriding any event defined in the .NET Framework are identical and are summarized in the following list. #### To override an inherited event @@ -82,6 +83,6 @@ public class PaintEventArgs : EventArgs { ## See also -- [Events](https://docs.microsoft.com/dotnet/standard/events/index) +- [Events](/dotnet/standard/events/index) - [Rendering a Windows Forms Control](rendering-a-windows-forms-control.md) - [Defining an Event](defining-an-event-in-windows-forms-controls.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/printdocument-component-overview-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/printdocument-component-overview-windows-forms.md index 4ae01c2..8f0a0b0 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/printdocument-component-overview-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/printdocument-component-overview-windows-forms.md @@ -18,7 +18,7 @@ Two of the main scenarios that involve the component to a Windows Form, then add programming logic that prints a file in the event handler. The programming logic should culminate with the method to print the document. This method sends a object, contained in the property of the class, to the printer. For an example that shows how to print a text document using the component, see [How to: Print a Multi-Page Text File in Windows Forms](../advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md). -- More complex print jobs, such as a situation where you will want to reuse printing logic you have written. In such a case you would derive a new component from the component and override (see [Overrides](https://docs.microsoft.com/dotnet/visual-basic/language-reference/modifiers/overrides) for Visual Basic or [override](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/override) for C#) the event. +- More complex print jobs, such as a situation where you will want to reuse printing logic you have written. In such a case you would derive a new component from the component and override (see [Overrides](/dotnet/visual-basic/language-reference/modifiers/overrides) for Visual Basic or [override](/dotnet/csharp/language-reference/keywords/override) for C#) the event. When it is added to a form, the component appears in the tray at the bottom of the Windows Forms Designer in Visual Studio. diff --git a/dotnet-desktop-guide/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md index 527f6e0..89e91c0 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md @@ -34,7 +34,7 @@ For apps running on the .NET Framework 4.5.2, you can add the following key to t If the `EnablePrintPreviewOptimization` key is set to any other value, or if the key is not present, the optimization is not applied. -For apps running on the .NET Framework 4.6 or later versions, you can add the following switch to the [\](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/runtime/appcontextswitchoverrides-element) element in the [\](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/runtime/index) section of your app config file: +For apps running on the .NET Framework 4.6 or later versions, you can add the following switch to the [\](/dotnet/framework/configure-apps/file-schema/runtime/appcontextswitchoverrides-element) element in the [\](/dotnet/framework/configure-apps/file-schema/runtime/index) section of your app config file: ```xml diff --git a/dotnet-desktop-guide/framework/winforms/controls/properties-in-windows-forms-controls.md b/dotnet-desktop-guide/framework/winforms/controls/properties-in-windows-forms-controls.md index 295a100..21a0006 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/properties-in-windows-forms-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/properties-in-windows-forms-controls.md @@ -8,11 +8,13 @@ helpviewer_keywords: ms.assetid: 2785279b-fb57-4937-8f6b-2050e475db6f --- # Properties in Windows Forms Controls + A Windows Forms control inherits many properties form the base class . These include properties such as , , , , , , , , , , , , and many others. For details about inherited properties, see . You can override inherited properties in your control as well as define new properties. ## In This Section + [Defining a Property](defining-a-property-in-windows-forms-controls.md) Shows how to implement a property for a custom control or component and shows how to integrate the property into the design environment. @@ -29,6 +31,7 @@ A Windows Forms control inherits many properties form the base class Documents the base class for implementing composite controls. @@ -39,11 +42,12 @@ A Windows Forms control inherits many properties form the base class to use for a custom property. ## Related Sections + [Attributes in Windows Forms Controls](attributes-in-windows-forms-controls.md) Describes the attributes you can apply to properties or other members of your custom controls and components. - [Design-Time Attributes for Components](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)) + [Design-Time Attributes for Components](/previous-versions/visualstudio/visual-studio-2013/tk67c2t8(v=vs.120)) Lists metadata attributes to apply to components and controls so that they are displayed correctly at design time in visual designers. - [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) + [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) Describes how to implement classes such as editors and designers that provide design-time support. diff --git a/dotnet-desktop-guide/framework/winforms/controls/property-changed-events.md b/dotnet-desktop-guide/framework/winforms/controls/property-changed-events.md index b3ea87b..67e362c 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/property-changed-events.md +++ b/dotnet-desktop-guide/framework/winforms/controls/property-changed-events.md @@ -10,7 +10,8 @@ helpviewer_keywords: ms.assetid: 268039ec-5aaa-4d76-b902-acccb036c850 --- # Property-Changed Events -If you want your control to send notifications when a property named *PropertyName* changes, define an event named *PropertyName*`Changed` and a method named `On`*PropertyName*`Changed` that raises the event. The naming convention in Windows Forms is to append the word *Changed* to the name of the property. The associated event delegate type for property-changed events is , and the event data type is . The base class defines many property-changed events, such as , , , , and others. For background information about events, see [Events](https://docs.microsoft.com/dotnet/standard/events/index) and [Events in Windows Forms Controls](events-in-windows-forms-controls.md). + +If you want your control to send notifications when a property named *PropertyName* changes, define an event named *PropertyName*`Changed` and a method named `On`*PropertyName*`Changed` that raises the event. The naming convention in Windows Forms is to append the word *Changed* to the name of the property. The associated event delegate type for property-changed events is , and the event data type is . The base class defines many property-changed events, such as , , , , and others. For background information about events, see [Events](/dotnet/standard/events/index) and [Events in Windows Forms Controls](events-in-windows-forms-controls.md). Property-changed events are useful because they allow consumers of a control to attach event handlers that respond to the change. If your control needs to respond to a property-changed event that it raises, override the corresponding `On`*PropertyName*`Changed` method instead of attaching a delegate to the event. A control typically responds to a property-changed event by updating other properties or by redrawing some or all of its drawing surface. @@ -21,6 +22,6 @@ If you want your control to send notifications when a property named *PropertyNa ## See also -- [Events](https://docs.microsoft.com/dotnet/standard/events/index) +- [Events](/dotnet/standard/events/index) - [Events in Windows Forms Controls](events-in-windows-forms-controls.md) - [Properties in Windows Forms Controls](properties-in-windows-forms-controls.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/raise-change-notifications--bindingsource.md b/dotnet-desktop-guide/framework/winforms/controls/raise-change-notifications--bindingsource.md index b66aa82..e4d56aa 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/raise-change-notifications--bindingsource.md +++ b/dotnet-desktop-guide/framework/winforms/controls/raise-change-notifications--bindingsource.md @@ -15,20 +15,23 @@ helpviewer_keywords: ms.assetid: 7fa2cf51-c09f-4375-adf0-e36c5617f099 --- # How to: Raise Change Notifications Using a BindingSource and the INotifyPropertyChanged Interface + The component automatically detects changes in a data source when the type contained in the data source implements and raises events when a property value is changed. This change detection is useful because controls bound to the automatically update as the data source values change. > [!NOTE] > If your data source implements and you are performing asynchronous operations, you should not make changes to the data source on a background thread. Instead, you should read the data on a background thread and merge the data into a list on the UI thread. ## Example + The following code example demonstrates a simple implementation of the interface. It also shows how the automatically passes a data source change to a bound control when the is bound to a list of the type. - If you use the `CallerMemberName` attribute, calls to the `NotifyPropertyChanged` method don't have to specify the property name as a string argument. For more information, see [Caller Information (C#)](https://docs.microsoft.com/dotnet/csharp/language-reference/attributes/caller-information) or [Caller Information (Visual Basic)](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/concepts/caller-information). + If you use the `CallerMemberName` attribute, calls to the `NotifyPropertyChanged` method don't have to specify the property name as a string argument. For more information, see [Caller Information (C#)](/dotnet/csharp/language-reference/attributes/caller-information) or [Caller Information (Visual Basic)](/dotnet/visual-basic/programming-guide/concepts/caller-information). [!code-csharp[System.ComponentModel.IPropertyChangeExample#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.ComponentModel.IPropertyChangeExample/CS/Form1.cs#1)] [!code-vb[System.ComponentModel.IPropertyChangeExample#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.ComponentModel.IPropertyChangeExample/VB/Form1.vb#1)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Drawing, and System.Windows.Forms assemblies. diff --git a/dotnet-desktop-guide/framework/winforms/controls/rendering-a-windows-forms-control.md b/dotnet-desktop-guide/framework/winforms/controls/rendering-a-windows-forms-control.md index 6b0d8a2..6b61e58 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/rendering-a-windows-forms-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/rendering-a-windows-forms-control.md @@ -12,6 +12,7 @@ helpviewer_keywords: ms.assetid: aae8e1e6-4786-432b-a15e-f4c44760d302 --- # Rendering a Windows Forms Control + Rendering refers to the process of creating a visual representation on a user's screen. Windows Forms uses GDI (the new Windows graphics library) for rendering. The managed classes that provide access to GDI are in the namespace and its subnamespaces. The following elements are involved in control rendering: @@ -25,7 +26,8 @@ Rendering refers to the process of creating a visual representation on a user's - The procedure for freeing graphics resources. ## Drawing Functionality Provided by Control - The base class provides drawing functionality through its event. A control raises the event whenever it needs to update its display. For more information about events in the .NET Framework, see [Handling and Raising Events](https://docs.microsoft.com/dotnet/standard/events/index). + + The base class provides drawing functionality through its event. A control raises the event whenever it needs to update its display. For more information about events in the .NET Framework, see [Handling and Raising Events](/dotnet/standard/events/index). The event data class for the event, , holds the data needed for drawing a control — a handle to a graphics object and a rectangle object that represents the region to draw in. These objects are shown in bold in the following code fragment. @@ -87,9 +89,11 @@ protected virtual void OnPaintBackground(PaintEventArgs pevent); While has an event-like nomenclature and takes the same argument as the `OnPaint` method, is not a true event method. There is no `PaintBackground` event and does not invoke event delegates. When overriding the method, a derived class is not required to invoke the method of its base class. ## GDI+ Basics + The class provides methods for drawing various shapes such as circles, triangles, arcs, and ellipses, as well as methods for displaying text. The namespace and its subnamespaces contain classes that encapsulate graphics elements such as shapes (circles, rectangles, arcs, and others), colors, fonts, brushes, and so on. For more information about GDI, see [Using Managed Graphics Classes](../advanced/using-managed-graphics-classes.md). The essentials of GDI are also described in the [How to: Create a Windows Forms Control That Shows Progress](how-to-create-a-windows-forms-control-that-shows-progress.md). ## Geometry of the Drawing Region + The property of a control specifies the rectangular region available to the control on the user's screen, while the property of specifies the area that is actually painted. (Remember that painting is done in the event method that takes a instance as its argument). A control might need to paint only a portion of its available area, as is the case when a small section of the control's display changes. In those situations, a control developer must compute the actual rectangle to draw in and pass that to . The overloaded versions of that take a or as an argument use that argument to generate the property of . The following code fragment shows how the `FlashTrackBar` custom control computes the rectangular area to draw in. The `client` variable denotes the property. For a complete sample, see [How to: Create a Windows Forms Control That Shows Progress](how-to-create-a-windows-forms-control-that-shows-progress.md). @@ -98,6 +102,7 @@ protected virtual void OnPaintBackground(PaintEventArgs pevent); [!code-vb[System.Windows.Forms.FlashTrackBar#6](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FlashTrackBar/VB/FlashTrackBar.vb#6)] ## Freeing Graphics Resources + Graphics objects are expensive because they use system resources. Such objects include instances of the class as well as instances of , , and other graphics classes. It is important that you create a graphics resource only when you need it and release it soon as you are finished using it. If you create a type that implements the interface, call its method when you are finished with it in order to free resources. The following code fragment shows how the `FlashTrackBar` custom control creates and releases a resource. For the complete source code, see [How to: Create a Windows Forms Control That Shows Progress](how-to-create-a-windows-forms-control-that-shows-progress.md). diff --git a/dotnet-desktop-guide/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md b/dotnet-desktop-guide/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md index 787228a..2446395 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md @@ -16,9 +16,10 @@ helpviewer_keywords: ms.assetid: 8025247a-2de4-4d86-b8ab-a8cb8aeab2ea --- # How to: Run Procedures at Set Intervals with the Windows Forms Timer Component + You might sometimes want to create a procedure that runs at specific time intervals until a loop has finished or that runs when a set time interval has elapsed. The component makes such a procedure possible. - This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). + This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). > [!NOTE] > There are some limitations when using the component. For more information, see [Limitations of the Windows Forms Timer Component's Interval Property](limitations-of-the-timer-component-interval-property.md). @@ -39,6 +40,7 @@ You might sometimes want to create a procedure that runs at specific time interv 5. At the appropriate time, set the property to `false` to stop the procedure from running again. Setting the interval to `0` does not cause the timer to stop. ## Example + This first code example tracks the time of day in one-second increments. It uses a , a , and a component on a form. The property is set to 1000 (equal to one second). In the event, the label's caption is set to the current time. When the button is clicked, the property is set to `false`, stopping the timer from updating the label's caption. The following code example requires that you have a form with a control named `Button1`, a control named `Timer1`, and a control named `Label1`. ```vb @@ -144,6 +146,7 @@ private: ``` ## Example + This second code example runs a procedure every 600 milliseconds until a loop has finished. The following code example requires that you have a form with a control named `Button1`, a control named `Timer1`, and a control named `Label1`. ```vb diff --git a/dotnet-desktop-guide/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md b/dotnet-desktop-guide/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md index 0898755..3600355 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md +++ b/dotnet-desktop-guide/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md @@ -19,7 +19,7 @@ manager: jillfra Your custom controls will sometimes expose a collection as a property. This walkthrough demonstrates how to use the class to control how a collection is serialized at design time. Applying the value to your collection property ensures that the property will be serialized. -To copy the code in this topic as a single listing, see [How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/ms171833(v=vs.120)). +To copy the code in this topic as a single listing, see [How to: Serialize Collections of Standard Types with the DesignerSerializationVisibilityAttribute](/previous-versions/visualstudio/visual-studio-2013/ms171833(v=vs.120)). ## Prerequisites @@ -123,11 +123,11 @@ To test the serialization behavior of your control, you will place it on a form Once you know how to serialize a collection of standard types, consider integrating your custom controls more deeply into the design-time environment. The following topics describe how to enhance the design-time integration of your custom controls: -- [Design-Time Architecture](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/c5z9s1h4(v=vs.120)) +- [Design-Time Architecture](/previous-versions/visualstudio/visual-studio-2013/c5z9s1h4(v=vs.120)) - [Attributes in Windows Forms Controls](attributes-in-windows-forms-controls.md) -- [Designer Serialization Overview](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/ms171834(v=vs.120)) +- [Designer Serialization Overview](/previous-versions/visualstudio/visual-studio-2013/ms171834(v=vs.120)) - [Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features](creating-a-wf-control-design-time-features.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md b/dotnet-desktop-guide/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md index 8cb808b..ebd3f64 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md +++ b/dotnet-desktop-guide/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md @@ -15,10 +15,11 @@ helpviewer_keywords: ms.assetid: 6c206daf-d706-4602-9dbe-435343052063 --- # How to: Sort and Filter ADO.NET Data with the Windows Forms BindingSource Component + You can expose the sorting and filtering capability of control through the and properties. You can apply simple sorting when the underlying data source is an , and you can apply filtering and advanced sorting when the data source is an . The property requires standard ADO.NET syntax: a string representing the name of a column of data in the data source followed by `ASC` or `DESC` to indicate whether the list should be sorted in ascending or descending order. You can set advanced sorting or multiple-column sorting by separating each column with a comma separator. The property takes a string expression. > [!NOTE] -> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). +> Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication (also known as integrated security) is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). ### To filter data with the BindingSource @@ -39,17 +40,19 @@ You can expose the sorting and filtering capability of control, and filters and sorts the displayed data. [!code-csharp[System.Windows.Forms.DataConnectorFilterAndSort#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorFilterAndSort/CS/form1.cs#1)] [!code-vb[System.Windows.Forms.DataConnectorFilterAndSort#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorFilterAndSort/VB/form1.vb#1)] ## Compiling the Code + To run this example, paste the code into a form that contains a named `BindingSource1` and a named `dataGridView1`. Handle the event for the form and call `InitializeSortedFilteredBindingSource` in the load event handler method. ## See also - - -- [How to: Install Sample Databases](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/8b6y4c7s(v=vs.120)) +- [How to: Install Sample Databases](/previous-versions/visualstudio/visual-studio-2013/8b6y4c7s(v=vs.120)) - [BindingSource Component](bindingsource-component.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/soundplayer-class.md b/dotnet-desktop-guide/framework/winforms/controls/soundplayer-class.md index e1af074..a88a72e 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/soundplayer-class.md +++ b/dotnet-desktop-guide/framework/winforms/controls/soundplayer-class.md @@ -8,11 +8,13 @@ helpviewer_keywords: ms.assetid: f3945af9-045c-4e2d-b251-377c37ca2d77 --- # SoundPlayer Class + The `SoundPlayer` class enables you to easily include sounds in your applications. You can also use the class to play common system sounds, including a beep. ## In This Section + [SoundPlayer Class Overview](soundplayer-class-overview.md) Introduces the class and its commonly used properties, methods, and events. @@ -35,10 +37,12 @@ The `SoundPlayer` class enables you to easily include sounds in your application Provides code that plays a sound repeatedly. ## Reference + Describes this class and has links to all its members. ## Related Sections + [Windows Forms Controls](index.md) Provides links to topics about the controls designed specifically to work with Windows Forms. @@ -47,4 +51,4 @@ The `SoundPlayer` class enables you to easily include sounds in your application ## See also -- [My.Computer Object](https://docs.microsoft.com/dotnet/visual-basic/language-reference/objects/my-computer-object) +- [My.Computer Object](/dotnet/visual-basic/language-reference/objects/my-computer-object) diff --git a/dotnet-desktop-guide/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md index 20ec08c..229969f 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md @@ -8,6 +8,7 @@ helpviewer_keywords: ms.assetid: 6de5a5f7-97a5-402d-be6d-7e2785483db5 --- # SplitContainer Control Overview (Windows Forms) + The Windows Forms control can be thought of as a composite; it is two panels separated by a movable bar. When the mouse pointer is over the bar, the pointer changes shape to show that the bar is movable. > [!IMPORTANT] @@ -47,4 +48,4 @@ The Windows Forms control can be thou - - [SplitContainer Control](splitcontainer-control-windows-forms.md) -- [SplitContainer Control Sample](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/0ffz7d1b(v=vs.90)) +- [SplitContainer Control Sample](/previous-versions/visualstudio/visual-studio-2008/0ffz7d1b(v=vs.90)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control-overview.md b/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control-overview.md index d58f995..a3fcae0 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control-overview.md +++ b/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control-overview.md @@ -9,13 +9,14 @@ helpviewer_keywords: ms.assetid: c0d9bcbb-f8b8-46ef-bae2-4146b8c8ce99 --- # StatusStrip Control Overview + A control displays information about an object being viewed on a , the object's components, or contextual information that relates to that object's operation within your application. Typically, a control consists of objects, each of which displays text, an icon, or both. The can also contain , , and controls. The default has no panels. To add panels to a , use the method. There is extensive support for handling items and common commands in Visual Studio. - Also see [StatusStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) and [StatusStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)). + Also see [StatusStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) and [StatusStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)). Although replaces and extends the control of previous versions, is retained for both backward compatibility and future use if you choose. diff --git a/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control.md b/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control.md index 5d29948..e10d93c 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/statusstrip-control.md @@ -7,18 +7,21 @@ helpviewer_keywords: ms.assetid: eb1e59da-0a48-4ce5-af7d-13b8e75af4b1 --- # StatusStrip Control + The Windows Forms `StatusStrip` control is used on forms as an area, usually displayed at the bottom of a window, in which an application can display various kinds of status information. `StatusStrip` controls typically have `ToolStripStatusLabel` controls on them that display text or icons to indicate state, or a that graphically displays the completion state of a process. ## In This Section + [StatusStrip Control Overview](statusstrip-control-overview.md) Explains what this control is and its key features and properties. [How to: Use the Spring Property Interactively in a StatusStrip](how-to-use-the-spring-property-interactively-in-a-statusstrip.md) Demonstrates using the `Spring` property to interactively center a `ToolStripStatusLabel` in a `StatusStrip`. - Also see [StatusStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) and [StatusStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)). + Also see [StatusStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) and [StatusStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)). ## Reference + Provides reference information on the class and its members. diff --git a/dotnet-desktop-guide/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md index a463c50..26000ec 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md @@ -11,9 +11,11 @@ helpviewer_keywords: ms.assetid: f55175c6-424e-4782-a86e-3f79c1550235 --- # TableLayoutPanel Control (Windows Forms) + The control arranges its contents in a grid. Because the layout is performed both at design time and run time, it can change dynamically as the application environment changes. This gives the controls in the panel the ability to proportionally resize, so it can respond to changes such as the parent control resizing or text length changing due to localization. ## In This Section + [TableLayoutPanel Control Overview](tablelayoutpanel-control-overview.md) Introduces the general concepts of the control, which allows you to create a layout with rows and columns. @@ -41,6 +43,7 @@ The control arranges its contents i 4. [Walkthrough: Arranging Controls on Windows Forms Using a TableLayoutPanel](walkthrough-arranging-controls-on-windows-forms-using-a-tablelayoutpanel.md) ## Reference + Provides reference documentation for the control. @@ -51,7 +54,8 @@ The control arranges its contents i Provides reference documentation for the control. ## Related Sections - [Localization](https://docs.microsoft.com/dotnet/standard/globalization-localization/localization) + + [Localization](/dotnet/standard/globalization-localization/localization) Provides an overview of topics relating to localization. - Also see [Localizing Applications](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/z68135h5(v=vs.120)). + Also see [Localizing Applications](/previous-versions/visualstudio/visual-studio-2013/z68135h5(v=vs.120)). diff --git a/dotnet-desktop-guide/framework/winforms/controls/timer-component-overview-windows-forms.md b/dotnet-desktop-guide/framework/winforms/controls/timer-component-overview-windows-forms.md index b18479d..136c325 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/timer-component-overview-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/controls/timer-component-overview-windows-forms.md @@ -9,9 +9,11 @@ helpviewer_keywords: ms.assetid: e672c05b-a8b6-4b26-9e4d-9223aa9e3873 --- # Timer Component Overview (Windows Forms) -The Windows Forms is a component that raises an event at regular intervals. This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). + +The Windows Forms is a component that raises an event at regular intervals. This component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). ## Key Properties, Methods, and Events + The length of the intervals is defined by the property, whose value is in milliseconds. When the component is enabled, the event is raised every interval. This is where you would add code to be executed. For more information, see [How to: Run Procedures at Set Intervals with the Windows Forms Timer Component](run-procedures-at-set-intervals-with-wf-timer-component.md). The key methods of the component are and , which turn the timer on and off. When the timer is switched off, it resets; there is no way to pause a component. ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/toolstrip-technology-summary.md b/dotnet-desktop-guide/framework/winforms/controls/toolstrip-technology-summary.md index fd59244..d8e8fba 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/toolstrip-technology-summary.md +++ b/dotnet-desktop-guide/framework/winforms/controls/toolstrip-technology-summary.md @@ -9,14 +9,17 @@ helpviewer_keywords: ms.assetid: e8d61973-7af9-429f-9df5-05a899c15a7b --- # ToolStrip Technology Summary + This topic summarizes information about the `ToolStrip` control and the classes that support its use. The `ToolStrip` control and its associated classes provide a complete solution for creating toolbars, status bars, and menus. ## Namespaces + ## Background + With the `ToolStrip` control and its associated classes, you can create advanced toolbar functionality that has consistent and professional appearance and behavior. The `ToolStrip` control and classes offer the following improvements over previous controls: - A more consistent event model. @@ -42,6 +45,7 @@ This topic summarizes information about the `ToolStrip` control and the classes The `ToolStrip`, `MenuStrip`, `ContextMenuStrip`, and `StatusStrip` controls replace the previous toolbar, menu, shortcut menu, and status bar controls, although those controls are retained for backward compatibility. ## ToolStrip Classes at a Glance + The following table shows the ToolStrip classes grouped by technology area. |Technology area|Class| @@ -52,38 +56,43 @@ This topic summarizes information about the `ToolStrip` control and the classes |Presentation and rendering|







| ## ToolStrip Design-Time Features + The family of controls provides a rich set of tools and templates for in-place editing and defining the foundation of the user interface so that you can quickly create a working application. ### Task Dialog Boxes + In Visual Studio, clicking the smart tag on a control in the designer displays a task list for convenient access to many frequently used commands. -- [MenuStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233645(v=vs.100)) +- [MenuStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233645(v=vs.100)) -- [ToolStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233648(v=vs.100)) +- [ToolStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233648(v=vs.100)) -- [ContextMenuStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233646(v=vs.100)) +- [ContextMenuStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233646(v=vs.100)) -- [StatusStrip Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)) +- [StatusStrip Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233642(v=vs.100)) -- [ToolStripContainer Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233647(v=vs.100)) +- [ToolStripContainer Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233647(v=vs.100)) ### Items Collection Editors + In Visual Studio, when you click **Edit Items** on the task list or right-click the control and select **Edit Items** in the shortcut menu, the collection editor for the control is displayed. Collection editors let you add, remove, and reorder items that the control contains. You can also view and change the properties for the control and the control's items. -- [MenuStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233625(v=vs.100)) +- [MenuStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233625(v=vs.100)) -- [StatusStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) +- [StatusStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233631(v=vs.100)) -- [ContextMenuStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233641(v=vs.100)) +- [ContextMenuStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233641(v=vs.100)) -- [ToolStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233643(v=vs.100)) +- [ToolStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233643(v=vs.100)) ## Hosting Controls + The class provides built-in wrappers for , , and controls. You can also host any other existing or COM control in a . For an example of control hosting, see [How to: Wrap a Windows Forms Control with ToolStripControlHost](how-to-wrap-a-windows-forms-control-with-toolstripcontrolhost.md). ## Rendering + classes implement a rendering scheme that is significantly different from other Windows Forms controls. With this scheme, you can easily apply styles and themes. To apply a style to a and all the objects it contains, you do not have to handle the event for each item. Instead, you can set the property to one of the values other than . Alternatively, you can set the directly to any class that inherits from the class. Setting this property automatically sets the . @@ -93,9 +102,11 @@ This topic summarizes information about the `ToolStrip` control and the classes For examples of rendering, see [How to: Create and Set a Custom Renderer for the ToolStrip Control in Windows Forms](create-and-set-a-custom-renderer-for-the-toolstrip-control-in-wf.md). ## Styles and Themes + and associated classes provide an easy way to support visual styles and custom appearance that do not require overriding the methods for each item. Use the and the and properties. ## Rafting and Docking + You can raft, dock, or absolutely position controls. items are laid out by the of the container. *Rafting* is the ability of toolbars to share horizontal or vertical space. A Windows form can have a that in turn has panels on the form's left, right, top, and bottom sides for positioning and rafting , , and controls. Multiple controls stack vertically if you put them in the left or right . They stack horizontally if you put them in the top or bottom . You can use the central of the to position traditional controls on the form. diff --git a/dotnet-desktop-guide/framework/winforms/controls/toolstripcontainer-control.md b/dotnet-desktop-guide/framework/winforms/controls/toolstripcontainer-control.md index b7adbde..98e3fa2 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/toolstripcontainer-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/toolstripcontainer-control.md @@ -8,11 +8,13 @@ helpviewer_keywords: ms.assetid: 378fa5b4-38e1-46f4-8e5c-d0c19dcd0200 --- # ToolStripContainer Control + controls feature built-in rafting (sharing of horizontal or vertical space within the tool area when docked) by using the . The topics in this section describe the concepts and techniques that you can use to build features into your applications. ## In This Section + [ToolStripContainer Control Overview](toolstripcontainer-control-overview.md) Provides topics that describe the purpose and main concepts of the Windows Forms control. @@ -23,15 +25,17 @@ ms.assetid: 378fa5b4-38e1-46f4-8e5c-d0c19dcd0200 Demonstrates adding a control to the . ## Reference + Provides reference documentation for the control. Provides reference documentation for the of a control. - Also see [ToolStripContainer Tasks Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233647(v=vs.100)). + Also see [ToolStripContainer Tasks Dialog Box](/previous-versions/visualstudio/visual-studio-2010/ms233647(v=vs.100)). ## Related Sections + Provides reference documentation for the control. diff --git a/dotnet-desktop-guide/framework/winforms/controls/toolstrippanel-control-overview.md b/dotnet-desktop-guide/framework/winforms/controls/toolstrippanel-control-overview.md index 060ea0c..768f5f8 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/toolstrippanel-control-overview.md +++ b/dotnet-desktop-guide/framework/winforms/controls/toolstrippanel-control-overview.md @@ -9,6 +9,7 @@ helpviewer_keywords: ms.assetid: ce54a60c-5eba-4b4c-bd77-cf0748a666cc --- # ToolStripPanel Control Overview + A provides a single area for positioning and rafting , , and controls. Multiple controls stack vertically or horizontally depending on the of the . ### Important ToolStripPanel Members @@ -26,4 +27,4 @@ A provides a single area for position - - -- [ToolStrip Sample](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/ms181005(v=vs.90)) +- [ToolStrip Sample](/previous-versions/visualstudio/visual-studio-2008/ms181005(v=vs.90)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/troubleshooting-control-and-component-authoring.md b/dotnet-desktop-guide/framework/winforms/controls/troubleshooting-control-and-component-authoring.md index fc7e3ff..e9c0368 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/troubleshooting-control-and-component-authoring.md +++ b/dotnet-desktop-guide/framework/winforms/controls/troubleshooting-control-and-component-authoring.md @@ -97,7 +97,7 @@ For more information about debugging, see [Debugging in Visual Studio](/visualst ## Event Is Raised Twice in Inherited Control or Component -This is likely due to a duplicated `Handles` clause. For more information, see [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers). +This is likely due to a duplicated `Handles` clause. For more information, see [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers). ## Design-Time Error: "Failed to Create Component 'Component Name'" diff --git a/dotnet-desktop-guide/framework/winforms/controls/varieties-of-custom-controls.md b/dotnet-desktop-guide/framework/winforms/controls/varieties-of-custom-controls.md index 185f0ee..5cea8cd 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/varieties-of-custom-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/varieties-of-custom-controls.md @@ -13,14 +13,16 @@ helpviewer_keywords: ms.assetid: 3cea09e5-4344-4ccb-9858-b66ccac210ff --- # Varieties of Custom Controls + With the .NET Framework, you can develop and implement new controls. You can extend the functionality of the familiar user control as well as existing controls through inheritance. You can also write custom controls that perform their own painting. Deciding which kind of control to create can be confusing. This topic highlights the differences among the various kinds of controls from which you can inherit, and provides you with information about how to choose a particular kind of control for your project. > [!NOTE] -> For information about authoring a control to use on Web Forms, see [Developing Custom ASP.NET Server Controls](https://docs.microsoft.com/previous-versions/aspnet/zt27tfhy(v=vs.100)). +> For information about authoring a control to use on Web Forms, see [Developing Custom ASP.NET Server Controls](/previous-versions/aspnet/zt27tfhy(v=vs.100)). ## Base Control Class + The class is the base class for Windows Forms controls. It provides the infrastructure required for visual display in Windows Forms applications. The class performs the following tasks to provide visual display in Windows Forms applications: @@ -40,9 +42,11 @@ With the .NET Framework, you can develop and implement new controls. You can ext Because so much of the infrastructure is provided by the base class, it is relatively easy to develop your own Windows Forms controls. ## Kinds of Controls + Windows Forms supports three kinds of user-defined controls: *composite*, *extended*, and *custom*. The following sections describe each kind of control and give recommendations for choosing the kind to use in your projects. ### Composite Controls + A composite control is a collection of Windows Forms controls encapsulated in a common container. This kind of control is sometimes called a *user control*. The contained controls are called *constituent controls*. A composite control holds all of the inherent functionality associated with each of the contained Windows Forms controls and enables you to selectively expose and bind their properties. A composite control also provides a great deal of default keyboard handling functionality with no extra development effort on your part. @@ -58,6 +62,7 @@ With the .NET Framework, you can develop and implement new controls. You can ext - You want to combine the functionality of several Windows Forms controls into a single reusable unit. ### Extended Controls + You can derive an inherited control from any existing Windows Forms control. With this approach, you can retain all of the inherent functionality of a Windows Forms control, and then extend that functionality by adding custom properties, methods, or other features. With this option, you can override the base control's paint logic, and then extend its user interface by changing its appearance. For example, you can create a control derived from the control that tracks how many times a user has clicked it. @@ -73,6 +78,7 @@ With the .NET Framework, you can develop and implement new controls. You can ext - You do not need a custom graphical user interface, or you want to design a new graphical user interface for an existing control. ### Custom Controls + Another way to create a control is to create one substantially from the beginning by inheriting from . The class provides all of the basic functionality required by controls, including mouse and keyboard handling events, but no control-specific functionality or graphical interface. Creating a control by inheriting from the class requires much more thought and effort than inheriting from or an existing Windows Forms control. Because a great deal of implementation is left for you, your control can have greater flexibility than a composite or extended control, and you can tailor your control to suit your exact needs. @@ -90,20 +96,23 @@ With the .NET Framework, you can develop and implement new controls. You can ext - You need to implement custom functionality that is not available through standard controls. ### ActiveX Controls + Although the Windows Forms infrastructure has been optimized to host Windows Forms controls, you can still use ActiveX controls. There is support for this task in Visual Studio. For more information, see [How to: Add ActiveX Controls to Windows Forms](how-to-add-activex-controls-to-windows-forms.md). ### Windowless Controls + The Microsoft Visual Basic® 6.0and ActiveX technologies support *windowless* controls. Windowless controls are not supported in Windows Forms. ## Custom Design Experience + If you need to implement a custom design-time experience, you can author your own designer. For composite controls, derive your custom designer class from the or the classes. For extended and custom controls, derive your custom designer class from the class. - Use the to associate your control with your designer. For more information, see [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) and [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)). + Use the to associate your control with your designer. For more information, see [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) and [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)). ## See also - [Developing Custom Windows Forms Controls with the .NET Framework](developing-custom-windows-forms-controls.md) - [How to: Develop a Simple Windows Forms Control](how-to-develop-a-simple-windows-forms-control.md) - [Developing a Composite Windows Forms Control](developing-a-composite-windows-forms-control.md) -- [Extending Design-Time Support](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) -- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) +- [Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)) +- [How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)) diff --git a/dotnet-desktop-guide/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md b/dotnet-desktop-guide/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md index e6e6e82..7de1381 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md +++ b/dotnet-desktop-guide/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md @@ -14,13 +14,16 @@ helpviewer_keywords: ms.assetid: 33825f92-7a22-40ee-86d9-9a2ed1ead7b7 --- # How to: Implement Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control + The following code example shows how to use virtual mode in the control with a data cache that loads data from a server only when it is needed. This example is described in detail in [Implementing Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control](implementing-virtual-mode-jit-data-loading-in-the-datagrid.md). ## Example + [!code-csharp[System.Windows.Forms.DataGridView.Virtual_lazyloading#000](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/CS/lazyloading.cs#000)] [!code-vb[System.Windows.Forms.DataGridView.Virtual_lazyloading#000](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.Virtual_lazyloading/VB/lazyloading.vb#000)] ## Compiling the Code + This example requires: - References to the System, System.Data, System.Xml, and System.Windows.Forms assemblies. @@ -28,7 +31,8 @@ The following code example shows how to use virtual mode in the arranges its contents in a speci The arranges its contents in a grid, providing functionality similar to the HTML \ element. The control allows you to place controls in a grid layout without requiring you to precisely specify the position of each individual control. Its cells are arranged in rows and columns, and these can have different sizes. Cells can be merged across rows and columns. Cells can contain anything a form can contain and behave in most other respects as containers. -The control also provides a proportional resizing capability at run time, so your layout can change smoothly as your form is resized. This makes the control well suited for purposes such as data-entry forms and localized applications. For more information, see [Walkthrough: Creating a Resizable Windows Form for Data Entry](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) and [Walkthrough: Creating a Localizable Windows Form](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)). +The control also provides a proportional resizing capability at run time, so your layout can change smoothly as your form is resized. This makes the control well suited for purposes such as data-entry forms and localized applications. For more information, see [Walkthrough: Creating a Resizable Windows Form for Data Entry](/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) and [Walkthrough: Creating a Localizable Windows Form](/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)). In general, you should not use a control as a container for the whole layout. Use controls to provide proportional resizing capabilities to parts of the layout. @@ -188,8 +188,8 @@ You can achieve a complex layout using a combination of layout panels and contro - - [Walkthrough: Arranging Controls on Windows Forms Using a FlowLayoutPanel](walkthrough-arranging-controls-on-windows-forms-using-a-flowlayoutpanel.md) - [Walkthrough: Arranging Controls on Windows Forms Using Snaplines](walkthrough-arranging-controls-on-windows-forms-using-snaplines.md) -- [Walkthrough: Creating a Resizable Windows Form for Data Entry](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) -- [Walkthrough: Creating a Localizable Windows Form](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)) +- [Walkthrough: Creating a Resizable Windows Form for Data Entry](/previous-versions/visualstudio/visual-studio-2010/991eahec(v=vs.100)) +- [Walkthrough: Creating a Localizable Windows Form](/previous-versions/visualstudio/visual-studio-2010/7k9fa71y(v=vs.100)) - [Best Practices for the TableLayoutPanel Control](best-practices-for-the-tablelayoutpanel-control.md) - [AutoSize Property Overview](autosize-property-overview.md) - [How to: Dock Controls on Windows Forms](how-to-dock-controls-on-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md index 315e4a8..cde68f6 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md @@ -9,7 +9,7 @@ ms.assetid: 2fa1e3e8-6b9f-42b2-97c0-2be57444dba4 --- # Walkthrough: Automatically Populating the Toolbox with Custom Components -If your components are defined by a project in the currently open solution, they will automatically appear in the **Toolbox**, with no action required by you. You can also manually populate the **Toolbox** with your custom components by using the [Choose Toolbox Items Dialog Box (Visual Studio)](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/dyca0t6t(v=vs.100)), but the **Toolbox** takes account of items in your solution's build outputs with all the following characteristics: +If your components are defined by a project in the currently open solution, they will automatically appear in the **Toolbox**, with no action required by you. You can also manually populate the **Toolbox** with your custom components by using the [Choose Toolbox Items Dialog Box (Visual Studio)](/previous-versions/visualstudio/visual-studio-2010/dyca0t6t(v=vs.100)), but the **Toolbox** takes account of items in your solution's build outputs with all the following characteristics: - Implements ; @@ -38,7 +38,7 @@ When you are finished, you will see that the **Toolbox** is populated with a com 2. Add a new component to the project. Call it `DemoComponent`. - For more information, see [How to: Add New Project Items](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/w0572c5b(v=vs.100)). + For more information, see [How to: Add New Project Items](/previous-versions/visualstudio/visual-studio-2010/w0572c5b(v=vs.100)). 3. Build the project. @@ -67,7 +67,7 @@ The **Toolbox** takes account of the components in each loaded project, and when 1. Unload the project from the solution. - For more information about unloading projects, see [How to: Unload and Reload Projects](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/tt479x1t(v=vs.100)). If you are prompted to save, choose **Yes**. + For more information about unloading projects, see [How to: Unload and Reload Projects](/previous-versions/visualstudio/visual-studio-2010/tt479x1t(v=vs.100)). If you are prompted to save, choose **Yes**. 2. Add a new **Windows Application** project to the solution. Open the form in the **Designer**. @@ -83,7 +83,7 @@ This walkthrough demonstrates that the **Toolbox** takes account of a project's ## See also -- [General, Windows Forms Designer, Options Dialog Box](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/5aazxs78(v=vs.100)) -- [How to: Manipulate Toolbox Tabs](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/66kwe227(v=vs.100)) -- [Choose Toolbox Items Dialog Box (Visual Studio)](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/dyca0t6t(v=vs.100)) +- [General, Windows Forms Designer, Options Dialog Box](/previous-versions/visualstudio/visual-studio-2010/5aazxs78(v=vs.100)) +- [How to: Manipulate Toolbox Tabs](/previous-versions/visualstudio/visual-studio-2010/66kwe227(v=vs.100)) +- [Choose Toolbox Items Dialog Box (Visual Studio)](/previous-versions/visualstudio/visual-studio-2010/dyca0t6t(v=vs.100)) - [Putting Controls on Windows Forms](putting-controls-on-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md index 18ab2f9..1b6ad0f 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md @@ -37,7 +37,7 @@ You'll need Visual Studio to complete this walkthrough. 2. In **Solution Explorer**, delete the project's default control by deleting the source file named "UserControl1.cs" or "UserControl1.vb", depending on your language of choice. - For more information, see [How to: Remove, Delete, and Exclude Items](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/0ebzhwsk(v=vs.100)). + For more information, see [How to: Remove, Delete, and Exclude Items](/previous-versions/visualstudio/visual-studio-2010/0ebzhwsk(v=vs.100)). 3. Add a new item to the **StackViewLibrary** project. Give the new source file a base name of `StackView`. @@ -122,7 +122,7 @@ Two events are important to make the `StackView` control behave correctly. Handl ## Define icons -Each `StackView` button has an associated icon. For convenience, each icon is represented as a Base64-encoded string, which is deserialized before a is created from it. In a production environment, you store bitmap data as a resource, and your icons appear in the Windows Forms Designer. For more information, see [How to: Add Background Images to Windows Forms](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/dff9f95f(v=vs.100)). +Each `StackView` button has an associated icon. For convenience, each icon is represented as a Base64-encoded string, which is deserialized before a is created from it. In a production environment, you store bitmap data as a resource, and your icons appear in the Windows Forms Designer. For more information, see [How to: Add Background Images to Windows Forms](/previous-versions/visualstudio/visual-studio-2010/dff9f95f(v=vs.100)). 1. In the Code Editor, insert the following code into the `StackView` class definition. This code initializes the bitmaps for the icons. diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md index e84d360..24576ae 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md @@ -92,7 +92,7 @@ In this procedure, you will define a separate child form class that has its own 1. Add a new form named `ChildForm` to the project. - For more information, see [How to: Add Windows Forms to a Project](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/y2xxdce3(v=vs.100)). + For more information, see [How to: Add Windows Forms to a Project](/previous-versions/visualstudio/visual-studio-2010/y2xxdce3(v=vs.100)). 2. From the **Toolbox**, drag a control onto the child form. @@ -100,7 +100,7 @@ In this procedure, you will define a separate child form class that has its own 4. In the **Items Collection Editor** dialog box, add a new named **ChildMenuItem** to the child menu. - For more information, see [ToolStrip Items Collection Editor](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233643(v=vs.100)). + For more information, see [ToolStrip Items Collection Editor](/previous-versions/visualstudio/visual-studio-2010/ms233643(v=vs.100)). ## Test the form diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md index 08e6c87..f8a17bb 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md @@ -46,7 +46,7 @@ For a complete listing of the code used in this example, see [How to: Implement 5. Rename the first control `startAsyncButton` and set the property to `Start Async`. Rename the second control `cancelAsyncButton`, and set the property to `Cancel Async`. Set its property to `false`. -6. Create an event handler for both of the controls' events. For details, see [How to: Create Event Handlers Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)). +6. Create an event handler for both of the controls' events. For details, see [How to: Create Event Handlers Using the Designer](/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)). 7. Drag a control from the **Toolbox** onto the form and rename it `resultLabel`. @@ -62,7 +62,7 @@ From the **Components** tab of the **Toolbox**, drag a component's asynchronous events. The time-consuming operation that will run in the background, which computes Fibonacci numbers, is called by one of these event handlers. -1. In the **Properties** window, with the component still selected, click the **Events** button. Double-click the and events to create event handlers. For more information about how to use event handlers, see [How to: Create Event Handlers Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)). +1. In the **Properties** window, with the component still selected, click the **Events** button. Double-click the and events to create event handlers. For more information about how to use event handlers, see [How to: Create Event Handlers Using the Designer](/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)). 2. Create a new method, called `ComputeFibonacci`, in your form. This method does the actual work, and it will run in the background. This code demonstrates the recursive implementation of the Fibonacci algorithm, which is notably inefficient, taking exponentially longer time to complete for larger numbers. It is used here for illustrative purposes, to show an operation that can introduce long delays in your application. @@ -146,17 +146,17 @@ Now that you have implemented a form that uses a [!CAUTION] - > When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. + > When using multithreading of any sort, you potentially expose yourself to very serious and complex bugs. Consult the [Managed Threading Best Practices](/dotnet/standard/threading/managed-threading-best-practices) before implementing any solution that uses multithreading. ## See also - -- [Managed Threading](https://docs.microsoft.com/dotnet/standard/threading/index) -- [Managed Threading Best Practices](https://docs.microsoft.com/dotnet/standard/threading/managed-threading-best-practices) -- [Event-based Asynchronous Pattern Overview](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) +- [Managed Threading](/dotnet/standard/threading/index) +- [Managed Threading Best Practices](/dotnet/standard/threading/managed-threading-best-practices) +- [Event-based Asynchronous Pattern Overview](/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-overview) - [How to: Implement a Form That Uses a Background Operation](how-to-implement-a-form-that-uses-a-background-operation.md) - [Walkthrough: Running an Operation in the Background](walkthrough-running-an-operation-in-the-background.md) - [BackgroundWorker Component](backgroundworker-component.md) diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md index 54244ac..5ba8016 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md @@ -24,7 +24,7 @@ When you create a new project, you specify its name in order to set the root nam 1. In Visual Studio, create a new **Windows Forms Control Library** project, and name it **ValueButtonLib**. - The project name, `ValueButtonLib`, is also assigned to the root namespace by default. The root namespace is used to qualify the names of components in the assembly. For example, if two assemblies provide components named `ValueButton`, you can specify your `ValueButton` component using `ValueButtonLib.ValueButton`. For more information, see [Namespaces](https://docs.microsoft.com/dotnet/csharp/programming-guide/namespaces/index). + The project name, `ValueButtonLib`, is also assigned to the root namespace by default. The root namespace is used to qualify the names of components in the assembly. For example, if two assemblies provide components named `ValueButton`, you can specify your `ValueButton` component using `ValueButtonLib.ValueButton`. For more information, see [Namespaces](/dotnet/csharp/programming-guide/namespaces/index). 2. In **Solution Explorer**, right-click **UserControl1.cs**, then choose **Rename** from the shortcut menu. Change the file name to **ValueButton.cs**. Click the **Yes** button when you are asked if you want to rename all references to the code element '`UserControl1`'. diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md index 51f2f0d..dde976d 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md @@ -90,7 +90,7 @@ For a complete listing of the code used in this example, see [How to: Run an Ope - Implement a form that reports progress as an asynchronous operation proceeds. For more information, see [How to: Implement a Form That Uses a Background Operation](how-to-implement-a-form-that-uses-a-background-operation.md). -- Implement a class that supports the Asynchronous Pattern for Components. For more information, see [Implementing the Event-based Asynchronous Pattern](https://docs.microsoft.com/dotnet/standard/asynchronous-programming-patterns/implementing-the-event-based-asynchronous-pattern). +- Implement a class that supports the Asynchronous Pattern for Components. For more information, see [Implementing the Event-based Asynchronous Pattern](/dotnet/standard/asynchronous-programming-patterns/implementing-the-event-based-asynchronous-pattern). ## See also diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md index 9ff13e0..b199941 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md @@ -13,6 +13,7 @@ helpviewer_keywords: ms.assetid: cc2abb06-c082-49f7-a5a3-2fd1bbcb58d1 --- # Walkthrough: Updating Status Bar Information at Run Time + > [!IMPORTANT] > The and controls replace and add functionality to the and controls; however, the and controls are retained for both backward compatibility and future use, if you choose. @@ -33,7 +34,7 @@ ms.assetid: cc2abb06-c082-49f7-a5a3-2fd1bbcb58d1 5. Add a Windows Forms component to the form. > [!NOTE] - > The Windows Forms component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). + > The Windows Forms component is designed for a Windows Forms environment. If you need a timer that is suitable for a server environment, see [Introduction to Server-Based Timers](/previous-versions/visualstudio/visual-studio-2008/tb9yt5e6(v=vs.90)). 6. Set the property to `true`. diff --git a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md index fb5765c..259ab70 100644 --- a/dotnet-desktop-guide/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md +++ b/dotnet-desktop-guide/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md @@ -45,7 +45,7 @@ In order to complete this walkthrough, you will need: This code example uses a `GetData` method that returns a populated object. Be sure that you set the `connectionString` variable to a value that is appropriate for your database. > [!IMPORTANT] - > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication, also known as integrated security, is a more secure way to control access to a database. For more information, see [Protecting Connection Information](https://docs.microsoft.com/dotnet/framework/data/adonet/protecting-connection-information). + > Storing sensitive information, such as a password, within the connection string can affect the security of your application. Using Windows Authentication, also known as integrated security, is a more secure way to control access to a database. For more information, see [Protecting Connection Information](/dotnet/framework/data/adonet/protecting-connection-information). [!code-csharp[System.Windows.Forms.DataGridViewDataValidation#30](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewDataValidation/CS/datavalidation.cs#30)] [!code-vb[System.Windows.Forms.DataGridViewDataValidation#30](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewDataValidation/VB/datavalidation.vb#30)] @@ -93,4 +93,4 @@ This application gives you a basic understanding of the control is designed to work in full trust only. The HTML content displayed in the control can come from external Web servers and may contain unmanaged code in the form of scripts or Web controls. If you use the control in this situation, the control is no less secure than Internet Explorer would be, but the managed control does not prevent such unmanaged code from running. - For more information about security issues relating to the underlying ActiveX `WebBrowser` control, see [WebBrowser Control](https://docs.microsoft.com/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752040(v=vs.85)). + For more information about security issues relating to the underlying ActiveX `WebBrowser` control, see [WebBrowser Control](/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752040(v=vs.85)). ## See also - - [WebBrowser Control Overview](webbrowser-control-overview.md) -- [WebBrowser Control](https://docs.microsoft.com/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752040(v=vs.85)) +- [WebBrowser Control](/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa752040(v=vs.85)) diff --git a/dotnet-desktop-guide/framework/winforms/creating-event-handlers-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/creating-event-handlers-in-windows-forms.md index 8f99590..94c4822 100644 --- a/dotnet-desktop-guide/framework/winforms/creating-event-handlers-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/creating-event-handlers-in-windows-forms.md @@ -31,13 +31,13 @@ An event handler is a procedure in your code that determines what actions are pe [Order of Events in Windows Forms](order-of-events-in-windows-forms.md)\ Describes the order in which events are raised in Windows Forms controls. - [How to: Create Event Handlers Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)) + [How to: Create Event Handlers Using the Designer](/previous-versions/visualstudio/visual-studio-2010/zwwsdtbk(v=vs.100)) Describes how to use the Windows Forms Designer to create event handlers. ## Related Sections - [Events](https://docs.microsoft.com/dotnet/standard/events/index)\ + [Events](/dotnet/standard/events/index)\ Provides links to topics on handling and raising events using the .NET Framework. - [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers)\ + [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers)\ Lists common issues that occur with event handlers in inherited components. diff --git a/dotnet-desktop-guide/framework/winforms/data-sources-supported-by-windows-forms.md b/dotnet-desktop-guide/framework/winforms/data-sources-supported-by-windows-forms.md index 64cbcd8..8cb3865 100644 --- a/dotnet-desktop-guide/framework/winforms/data-sources-supported-by-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/data-sources-supported-by-windows-forms.md @@ -17,9 +17,11 @@ helpviewer_keywords: ms.assetid: 3d2c43f6-462b-4d35-9c86-13e9afe012e1 --- # Data Sources Supported by Windows Forms + Traditionally, data binding has been used within applications to take advantage of data stored in databases. With Windows Forms data binding, you can access data from databases as well as data in other structures, such as arrays and collections, so long as certain minimum requirements have been met. ## Structures to Bind To + In Windows Forms, you can bind to a wide variety of structures, from simple objects (simple binding) to complex lists such as ADO.NET data tables (complex binding). For simple binding, Windows Forms supports binding to the public properties on the simple object. Windows Forms list-based binding generally requires that the object support the interface or the interface. Additionally, if you are binding with through a component, you can bind to an object that supports the interface. For more information about interfaces related to data binding, see [Interfaces Related to Data Binding](interfaces-related-to-data-binding.md). The following list shows the structures you can bind to in Windows Forms. @@ -31,7 +33,7 @@ Traditionally, data binding has been used within applications to take advantage Windows Forms supports data binding control properties to public properties on the instance of an object using the type. Windows Forms also supports binding list based controls, such as a to an object instance when a is used. array or collection - To act as a data source, a list must implement the interface; one example would be an array that is an instance of the class. For more information on arrays, see [How to: Create an Array of Objects (Visual Basic)](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/487y7874(v=vs.100)). + To act as a data source, a list must implement the interface; one example would be an array that is an instance of the class. For more information on arrays, see [How to: Create an Array of Objects (Visual Basic)](/previous-versions/visualstudio/visual-studio-2010/487y7874(v=vs.100)). In general, you should use when you create lists of objects for data binding. is a generic version of the interface. The interface extends the interface by adding properties, methods and events necessary for two-way data binding. diff --git a/dotnet-desktop-guide/framework/winforms/events-overview-windows-forms.md b/dotnet-desktop-guide/framework/winforms/events-overview-windows-forms.md index 3492556..4051e80 100644 --- a/dotnet-desktop-guide/framework/winforms/events-overview-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/events-overview-windows-forms.md @@ -11,6 +11,7 @@ helpviewer_keywords: ms.assetid: 814a6a43-a312-4791-88d8-f75f9a4f8c4c --- # Events Overview (Windows Forms) + An event is an action which you can respond to, or "handle," in code. Events can be generated by a user action, such as clicking the mouse or pressing a key; by program code; or by the system. Event-driven applications execute code in response to an event. Each form and control exposes a predefined set of events that you can program against. If one of these events occurs and there is code in the associated event handler, that code is invoked. @@ -20,14 +21,15 @@ An event is an action which you can respond to, or "handle," in code. Events can > [!NOTE] > Many events occur in conjunction with other events. For example, in the course of the event occurring, the , , and events occur. - For information about how to raise and consume an event, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). + For information about how to raise and consume an event, see [Events](/dotnet/standard/events/index). ## Delegates and Their Role + Delegates are classes commonly used within the .NET Framework to build event-handling mechanisms. Delegates roughly equate to function pointers, commonly used in Visual C++ and other object-oriented languages. Unlike function pointers however, delegates are object-oriented, type-safe, and secure. In addition, where a function pointer contains only a reference to a particular function, a delegate consists of a reference to an object, and references to one or more methods within the object. - This event model uses *delegates* to bind events to the methods that are used to handle them. The delegate enables other classes to register for event notification by specifying a handler method. When the event occurs, the delegate calls the bound method. For more information about how to define delegates, see [Events](https://docs.microsoft.com/dotnet/standard/events/index). + This event model uses *delegates* to bind events to the methods that are used to handle them. The delegate enables other classes to register for event notification by specifying a handler method. When the event occurs, the delegate calls the bound method. For more information about how to define delegates, see [Events](/dotnet/standard/events/index). -Delegates can be bound to a single method or to multiple methods, referred to as multicasting. When creating a delegate for an event, you (or the Windows) typically create a multicast event. A rare exception might be an event that results in a specific procedure (such as displaying a dialog box) that would not logically repeat multiple times per event. For information about how to create a multicast delegate, see [How to combine delegates (Multicast Delegates)](https://docs.microsoft.com/dotnet/csharp/programming-guide/delegates/how-to-combine-delegates-multicast-delegates). +Delegates can be bound to a single method or to multiple methods, referred to as multicasting. When creating a delegate for an event, you (or the Windows) typically create a multicast event. A rare exception might be an event that results in a specific procedure (such as displaying a dialog box) that would not logically repeat multiple times per event. For information about how to create a multicast delegate, see [How to combine delegates (Multicast Delegates)](/dotnet/csharp/programming-guide/delegates/how-to-combine-delegates-multicast-delegates). A multicast delegate maintains an invocation list of the methods it is bound to. The multicast delegate supports a method to add a method to the invocation list and a method to remove it. diff --git a/dotnet-desktop-guide/framework/winforms/high-dpi-support-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/high-dpi-support-in-windows-forms.md index db79452..4b6cffe 100644 --- a/dotnet-desktop-guide/framework/winforms/high-dpi-support-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/high-dpi-support-in-windows-forms.md @@ -43,7 +43,7 @@ In addition, to configure high DPI support in your Windows Forms application, yo - Enable per-monitor DPI awareness in the *app.config* file. - Windows Forms introduces a new [``](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/winforms/index) element to support new features and customizations added starting with the .NET Framework 4.7. To take advantage of the new features that support high DPI, add the following to your application configuration file. + Windows Forms introduces a new [``](/dotnet/framework/configure-apps/file-schema/winforms/index) element to support new features and customizations added starting with the .NET Framework 4.7. To take advantage of the new features that support high DPI, add the following to your application configuration file. ```xml @@ -78,7 +78,7 @@ Setting the `DpiAwareness` value to `PerMonitorV2` enables all high DPI awarenes ``` -For a list of individual keys and their values, see [Windows Forms Add Configuration Element](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/winforms/windows-forms-add-configuration-element). +For a list of individual keys and their values, see [Windows Forms Add Configuration Element](/dotnet/framework/configure-apps/file-schema/winforms/windows-forms-add-configuration-element). ## New DPI change events @@ -126,5 +126,5 @@ Console.WriteLine(AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName); ## See also -- [Windows Forms Add Configuration Element](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/winforms/windows-forms-add-configuration-element) +- [Windows Forms Add Configuration Element](/dotnet/framework/configure-apps/file-schema/winforms/windows-forms-add-configuration-element) - [Adjusting the Size and Scale of Windows Forms](adjusting-the-size-and-scale-of-windows-forms.md) diff --git a/dotnet-desktop-guide/framework/winforms/how-keyboard-input-works.md b/dotnet-desktop-guide/framework/winforms/how-keyboard-input-works.md index a8582f9..06a5737 100644 --- a/dotnet-desktop-guide/framework/winforms/how-keyboard-input-works.md +++ b/dotnet-desktop-guide/framework/winforms/how-keyboard-input-works.md @@ -8,12 +8,15 @@ helpviewer_keywords: ms.assetid: 9a29433c-a180-49bb-b74c-d187786584c8 --- # How Keyboard Input Works + Windows Forms processes keyboard input by raising keyboard events in response to Windows messages. Most Windows Forms applications process keyboard input exclusively by handling the keyboard events. However, you need to understand how keyboard messages work so you can implement more advanced keyboard-input scenarios, such as intercepting keys before they reach a control. This topic describes the types of key data that Windows Forms recognizes and provides an overview of how keyboard messages are routed. For information about keyboard events, see [Using Keyboard Events](using-keyboard-events.md). ## Types of Keys - Windows Forms identifies keyboard input as virtual-key codes that are represented by the bitwise enumeration. With the enumeration, you can combine a series of pressed keys to result in a single value. These values correspond to the values that accompany the WM_KEYDOWN and WM_SYSKEYDOWN Windows messages. You can detect most physical key presses by handling the or events. Character keys are a subset of the enumeration and correspond to the values that accompany the WM_CHAR and WM_SYSCHAR Windows messages. If the combination of pressed keys results in a character, you can detect the character by handling the event. Alternatively, you can use , exposed by Visual Basic programming interface, to discover which keys were pressed and send keys. For more information, see [Accessing the Keyboard](https://docs.microsoft.com/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-keyboar). + + Windows Forms identifies keyboard input as virtual-key codes that are represented by the bitwise enumeration. With the enumeration, you can combine a series of pressed keys to result in a single value. These values correspond to the values that accompany the WM_KEYDOWN and WM_SYSKEYDOWN Windows messages. You can detect most physical key presses by handling the or events. Character keys are a subset of the enumeration and correspond to the values that accompany the WM_CHAR and WM_SYSCHAR Windows messages. If the combination of pressed keys results in a character, you can detect the character by handling the event. Alternatively, you can use , exposed by Visual Basic programming interface, to discover which keys were pressed and send keys. For more information, see [Accessing the Keyboard](/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-keyboar). ## Order of Keyboard Events + As listed previously, there are 3 keyboard related events that can occur on a control. The following sequence shows the general order of the events: 1. The user pushes the "a" key, the key is preprocessed, dispatched, and a event occurs. @@ -25,6 +28,7 @@ Windows Forms processes keyboard input by raising keyboard events in response to 3. The user releases the "a" key, the key is preprocessed, dispatched and a event occurs. ## Preprocessing Keys + Like other messages, keyboard messages are processed in the method of a form or control. However, before keyboard messages are processed, the method calls one or more methods that can be overridden to handle special character keys and physical keys. You can override these methods to detect and filter certain keys before the messages are processed by the control. The following table shows the action that is being performed and the related method that occurs, in the order that the method occurs. ### Preprocessing for a KeyDown event @@ -43,6 +47,7 @@ Windows Forms processes keyboard input by raising keyboard events in response to |Check to see if the character is a mnemonic (such as &OK on a button)||This method, similar to , will be called up the control hierarchy. If the control is a container control, it checks for mnemonics by calling on itself and its child controls. If returns `true`, a event does not occur.| ## Processing Keyboard Messages + After keyboard messages reach the method of a form or control, they are processed by a set of methods that can be overridden. Each of these methods returns a value specifying whether the keyboard message has been processed and consumed by the control. If one of the methods returns `true`, then the message is considered handled, and it is not passed to the control's base or parent for further processing. Otherwise, the message stays in the message queue and may be processed in another method in the control's base or parent. The following table presents the methods that process keyboard messages. |Method|Notes| @@ -52,7 +57,8 @@ Windows Forms processes keyboard input by raising keyboard events in response to ||This method raises the , , and events, as appropriate.| ## Overriding Keyboard Methods - There are many methods available for overriding when a keyboard message is preprocessed and processed; however, some methods are much better choices than others. Following table shows tasks you might want to accomplish and the best way to override the keyboard methods. For more information on overriding methods, see [Overriding properties and methods in derived classes](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics#overriding-properties-and-methods-in-derived-classes). + + There are many methods available for overriding when a keyboard message is preprocessed and processed; however, some methods are much better choices than others. Following table shows tasks you might want to accomplish and the best way to override the keyboard methods. For more information on overriding methods, see [Overriding properties and methods in derived classes](/dotnet/visual-basic/programming-guide/language-features/objects-and-classes/inheritance-basics#overriding-properties-and-methods-in-derived-classes). |Task|Method| |----------|------------| @@ -67,6 +73,6 @@ Windows Forms processes keyboard input by raising keyboard events in response to - - - -- [My.Computer.Keyboard Object](https://docs.microsoft.com/dotnet/visual-basic/language-reference/objects/my-computer-keyboard-object) -- [Accessing the Keyboard](https://docs.microsoft.com/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-keyboar) +- [My.Computer.Keyboard Object](/dotnet/visual-basic/language-reference/objects/my-computer-keyboard-object) +- [Accessing the Keyboard](/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-keyboar) - [Using Keyboard Events](using-keyboard-events.md) diff --git a/dotnet-desktop-guide/framework/winforms/how-to-change-the-borders-of-windows-forms.md b/dotnet-desktop-guide/framework/winforms/how-to-change-the-borders-of-windows-forms.md index a72af15..6335c46 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-change-the-borders-of-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-change-the-borders-of-windows-forms.md @@ -10,11 +10,12 @@ helpviewer_keywords: ms.assetid: b3d5fa56-80c6-4b10-b505-f9672307ed55 --- # How to: Change the Borders of Windows Forms + You have several border styles to choose from when you are determining the appearance and behavior of your Windows Forms. By changing the property, you can control the resizing behavior of the form. In addition, setting the affects how the caption bar is displayed as well as what buttons might appear on it. For more information, see . There is extensive support for this task in Visual Studio. - See also [How to: Change the Borders of Windows Forms Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/yettzh3e(v=vs.100)). + See also [How to: Change the Borders of Windows Forms Using the Designer](/previous-versions/visualstudio/visual-studio-2010/yettzh3e(v=vs.100)). ### To set the border style of Windows Forms programmatically @@ -33,7 +34,7 @@ You have several border styles to choose from when you are determining the appea System::Windows::Forms::FormBorderStyle::FixedDialog; ``` - Also see [How to: Create Dialog Boxes at Design Time](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/55cz5x2c(v=vs.100)). + Also see [How to: Create Dialog Boxes at Design Time](/previous-versions/visualstudio/visual-studio-2010/55cz5x2c(v=vs.100)). Additionally, if you have chosen a border style for the form that provides optional **Minimize** and **Maximize** buttons, you can specify whether you want either or both of these buttons to be functional. These buttons are useful when you want to closely control the user experience. The **Minimize** and **Maximize** buttons are enabled by default, and their functionality is manipulated through the **Properties** window. diff --git a/dotnet-desktop-guide/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md b/dotnet-desktop-guide/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md index eee980c..c9c25a9 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md @@ -13,7 +13,7 @@ With Windows Forms data binding, you can format the data displayed in a data-bou ## To bind a control and format the displayed data -1. Connect to a data source. For more information, see [Connecting to a Data Source](https://docs.microsoft.com/dotnet/framework/data/adonet/connecting-to-a-data-source). +1. Connect to a data source. For more information, see [Connecting to a Data Source](/dotnet/framework/data/adonet/connecting-to-a-data-source). 2. In Visual Studio, select the control on the form, and then open the **Properties** window. @@ -40,7 +40,7 @@ With Windows Forms data binding, you can format the data displayed in a data-bou |Currency|Specify number of decimal places by using **Decimal places** up-down control.| |Date Time|Select how the date and time should be displayed by selecting one of the items in the **Type** selection box.| |Scientific|Specify number of decimal places by using **Decimal places** up-down control.| - |Custom|Specify a custom format string using.

For more information, see [Formatting Types](https://docs.microsoft.com/dotnet/standard/base-types/formatting-types). **Note:** Custom format strings are not guaranteed to successfully round trip between the data source and bound control. Instead handle the or event for the binding and apply custom formatting in the event-handling code.| + |Custom|Specify a custom format string using.

For more information, see [Formatting Types](/dotnet/standard/base-types/formatting-types). **Note:** Custom format strings are not guaranteed to successfully round trip between the data source and bound control. Instead handle the or event for the binding and apply custom formatting in the event-handling code.| 8. Select **OK** to close the **Formatting and Advanced Binding** dialog box and return to the Properties window. diff --git a/dotnet-desktop-guide/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md b/dotnet-desktop-guide/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md index 2a44d14..f5da0e8 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md @@ -12,7 +12,7 @@ With *simple binding*, you can display a single data element, such as a column v ## To simple-bind a control -1. Connect to a data source. For more information, see [Connecting to a Data Source](https://docs.microsoft.com/dotnet/framework/data/adonet/connecting-to-a-data-source). +1. Connect to a data source. For more information, see [Connecting to a Data Source](/dotnet/framework/data/adonet/connecting-to-a-data-source). 2. In Visual Studio, select the control on the form and display the **Properties** window. diff --git a/dotnet-desktop-guide/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md b/dotnet-desktop-guide/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md index 2106c71..5ba2f95 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md @@ -14,7 +14,7 @@ ms.assetid: 45ad3f8b-1c26-4c9f-91a9-3bb0759a47a4 --- # How to: Create a Windows Forms application from the command line -The following procedures describe the basic steps that you must complete to create and run a Windows Forms application from the command line. There is extensive support for these procedures in Visual Studio. Also see [Walkthrough: Hosting a Windows Forms Control in WPF](https://docs.microsoft.com/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf). +The following procedures describe the basic steps that you must complete to create and run a Windows Forms application from the command line. There is extensive support for these procedures in Visual Studio. Also see [Walkthrough: Hosting a Windows Forms Control in WPF](/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf). ## Procedure diff --git a/dotnet-desktop-guide/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md b/dotnet-desktop-guide/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md index b46ef9e..c101101 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md @@ -72,4 +72,4 @@ In addition to creating events using the Windows Forms Designer in Visual Studio - [Creating Event Handlers in Windows Forms](creating-event-handlers-in-windows-forms.md) - [Event Handlers Overview](event-handlers-overview-windows-forms.md) -- [Troubleshooting Inherited Event Handlers in Visual Basic](https://docs.microsoft.com/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) +- [Troubleshooting Inherited Event Handlers in Visual Basic](/dotnet/visual-basic/programming-guide/language-features/events/troubleshooting-inherited-event-handlers) diff --git a/dotnet-desktop-guide/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md b/dotnet-desktop-guide/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md index 20de638..93bf268 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md @@ -26,6 +26,7 @@ helpviewer_keywords: ms.assetid: 1e184048-0ae3-4067-a200-d4ba31dbc2cb --- # How to: Determine Which Modifier Key Was Pressed + When you create an application that accepts the user's keystrokes, you may also want to monitor for modifier keys such as the SHIFT, ALT, and CTRL keys. When a modifier key is pressed in combination with other keys, or with mouse clicks, your application can respond appropriately. For example, if the letter S is pressed, this may simply cause an "s" to appear on the screen, but if the keys CTRL+S are pressed, the current document may be saved. If you handle the event, the property of the received by the event handler specifies which modifier keys are pressed. Alternatively, the property of specifies the character that was pressed as well as any modifier keys combined with a bitwise OR. However, if you are handling the event or a mouse event, the event handler does not receive this information. In this case, you must use the property of the class. In either case, you must perform a bitwise AND of the appropriate value and the value you are testing. The enumeration offers variations of each modifier key, so it is important that you perform the bitwise AND with the correct value. For example, the SHIFT key is represented by , , and The correct value to test SHIFT as a modifier key is . Similarly, to test for CTRL and ALT as modifiers you should use the and values, respectively. > [!NOTE] @@ -44,4 +45,4 @@ When you create an application that accepts the user's keystrokes, you may also - - - [Keyboard Input in a Windows Forms Application](keyboard-input-in-a-windows-forms-application.md) -- [How to: Determine If CapsLock is On in Visual Basic](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/9c9d1fz9(v=vs.100)) +- [How to: Determine If CapsLock is On in Visual Basic](/previous-versions/visualstudio/visual-studio-2010/9c9d1fz9(v=vs.100)) diff --git a/dotnet-desktop-guide/framework/winforms/how-to-resize-windows-forms.md b/dotnet-desktop-guide/framework/winforms/how-to-resize-windows-forms.md index 68dedd3..810c8c0 100644 --- a/dotnet-desktop-guide/framework/winforms/how-to-resize-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/how-to-resize-windows-forms.md @@ -13,7 +13,7 @@ ms.assetid: 5d9dd47e-e68c-48c9-a0a3-a9ff34ba009d --- # How to: Resize Windows Forms -You can specify the size of your Windows Form in several ways. You can change both the height and the width of the form programmatically by setting a new value for the property, or adjust the or properties individually. If you're using Visual Studio, you can change the size using the Windows Forms Designer. Also see [How to: Resize Windows Forms Using the Designer](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/37k2zkwx(v=vs.100)). +You can specify the size of your Windows Form in several ways. You can change both the height and the width of the form programmatically by setting a new value for the property, or adjust the or properties individually. If you're using Visual Studio, you can change the size using the Windows Forms Designer. Also see [How to: Resize Windows Forms Using the Designer](/previous-versions/visualstudio/visual-studio-2010/37k2zkwx(v=vs.100)). ## Resize a form programmatically diff --git a/dotnet-desktop-guide/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md index e8a4295..a448132 100644 --- a/dotnet-desktop-guide/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md @@ -15,6 +15,7 @@ helpviewer_keywords: ms.assetid: 3cd3e55b-2f5e-40dd-835d-f50f7ce08967 --- # More Secure File and Data Access in Windows Forms + The .NET Framework uses permissions to help protect resources and data. Where your application can read or write data depends on the permissions granted to the application. When your application runs in a partial trust environment, you might not have access to your data or you might have to change the way you access the data. When you encounter a security restriction, you have two options: assert the permission (assuming it has been granted to your application), or use a version of the feature written to work in partial trust. The following sections discuss how to work with file, database, and registry access from applications that are running in a partial trust environment. @@ -23,9 +24,11 @@ The .NET Framework uses permissions to help protect resources and data. Where yo > By default, tools that generate ClickOnce deployments default these deployments to requesting Full Trust from the computers on which they run. If you decide you want the added security benefits of running in partial trust, you must change this default in either Visual Studio or one of the Windows SDK tools (Mage.exe or MageUI.exe). For more information about Windows Forms security, and on how to determine the appropriate trust level for your application, see [Security in Windows Forms Overview](security-in-windows-forms-overview.md). ## File Access + The class controls file and folder access in the .NET Framework. By default, the security system does not grant the to partial trust environments such as the local intranet and Internet zones. However, an application that requires file access can still function in these environments if you modify the design of your application or use different methods to access files. By default, the local intranet zone is granted the right to have same site access and same directory access, to connect back to the site of its origin, and to read from its installation directory. By default, the Internet zone, is only granted the right to connect back to the site of its origin. ### User-Specified Files + One way to deal with not having file access permission is to prompt the user to provide specific file information by using the or class. This user interaction helps provide some assurance that the application cannot maliciously load private files or overwrite important files. The and methods provide read and write file access by opening the file stream for the file that the user specified. The methods also help protect the user's file by obscuring the file's path. > [!NOTE] @@ -130,7 +133,8 @@ private void ButtonOpen_Click(object sender, System.EventArgs e) > In Visual C#, ensure that you add code to enable the event handler. By using the code from the previous example, the following code shows how to enable the event handler.`this.ButtonOpen.Click += newSystem.Windows.Forms.EventHandler(this.ButtonOpen_Click);` ### Other Files - Sometimes you will need to read or write to files that the user does not specify, such as when you must persist application settings. In the local intranet and Internet zones, your application will not have permission to store data in a local file. However, your application will be able to store data in isolated storage. Isolated storage is an abstract data compartment (not a specific storage location) that contains one or more isolated storage files, called stores, that contain the actual directory locations where data is stored. File access permissions like are not required; instead, the class controls the permissions for isolated storage. By default, applications that are running in the local intranet and Internet zones can store data using isolated storage; however, settings like disk quota can vary. For more information about isolated storage, see [Isolated Storage](https://docs.microsoft.com/dotnet/standard/io/isolated-storage). + + Sometimes you will need to read or write to files that the user does not specify, such as when you must persist application settings. In the local intranet and Internet zones, your application will not have permission to store data in a local file. However, your application will be able to store data in isolated storage. Isolated storage is an abstract data compartment (not a specific storage location) that contains one or more isolated storage files, called stores, that contain the actual directory locations where data is stored. File access permissions like are not required; instead, the class controls the permissions for isolated storage. By default, applications that are running in the local intranet and Internet zones can store data using isolated storage; however, settings like disk quota can vary. For more information about isolated storage, see [Isolated Storage](/dotnet/standard/io/isolated-storage). The following example uses isolated storage to write data to a file located in a store. The example requires and the enumeration value. The example demonstrates reading and writing certain property values of the control to a file in isolated storage. The `Read` function would be called after the application starts and the `Write` function would be called before the application ends. The example requires that the `Read` and `Write` functions exist as members of a that contains a control named `MainButton`. @@ -343,11 +347,13 @@ public void Write() ``` ## Database Access - The permissions required to access a database vary based on the database provider; however, only applications that are running with the appropriate permissions can access a database through a data connection. For more information about the permissions that are required to access a database, see [Code Access Security and ADO.NET](https://docs.microsoft.com/dotnet/framework/data/adonet/code-access-security). + + The permissions required to access a database vary based on the database provider; however, only applications that are running with the appropriate permissions can access a database through a data connection. For more information about the permissions that are required to access a database, see [Code Access Security and ADO.NET](/dotnet/framework/data/adonet/code-access-security). - If you cannot directly access a database because you want your application to run in partial trust, you can use a Web service as an alternative means to access your data. A Web service is a piece of software that can be programmatically accessed over a network. With Web services, applications can share data across code group zones. By default, applications in the local intranet and Internet zones are granted the right to access their sites of origin, which enables them to call a Web service hosted on the same server. For more information see [Web Services in ASP.NET AJAX](https://docs.microsoft.com/previous-versions/aspnet/bb398785(v=vs.100)) or [Windows Communication Foundation](https://docs.microsoft.com/dotnet/framework/wcf/index). + If you cannot directly access a database because you want your application to run in partial trust, you can use a Web service as an alternative means to access your data. A Web service is a piece of software that can be programmatically accessed over a network. With Web services, applications can share data across code group zones. By default, applications in the local intranet and Internet zones are granted the right to access their sites of origin, which enables them to call a Web service hosted on the same server. For more information see [Web Services in ASP.NET AJAX](/previous-versions/aspnet/bb398785(v=vs.100)) or [Windows Communication Foundation](/dotnet/framework/wcf/index). ## Registry Access + The class controls access to the operating system registry. By default, only applications that are running locally can access the registry. only grants an application the right to try registry access; it does not guarantee access will succeed, because the operating system still enforces security on the registry. Because you cannot access the registry under partial trust, you may need to find other methods of storing your data. When you store application settings, use isolated storage instead of the registry. Isolated storage can also be used to store other application-specific files. You can also store global application information about the server or site of origin, because by default an application is granted the right to access the site of its origin. @@ -358,5 +364,5 @@ public void Write() - [Additional Security Considerations in Windows Forms](additional-security-considerations-in-windows-forms.md) - [Security in Windows Forms Overview](security-in-windows-forms-overview.md) - [Windows Forms Security](windows-forms-security.md) -- [Mage.exe (Manifest Generation and Editing Tool)](https://docs.microsoft.com/dotnet/framework/tools/mage-exe-manifest-generation-and-editing-tool) -- [MageUI.exe (Manifest Generation and Editing Tool, Graphical Client)](https://docs.microsoft.com/dotnet/framework/tools/mageui-exe-manifest-generation-and-editing-tool-graphical-client) +- [Mage.exe (Manifest Generation and Editing Tool)](/dotnet/framework/tools/mage-exe-manifest-generation-and-editing-tool) +- [MageUI.exe (Manifest Generation and Editing Tool, Graphical Client)](/dotnet/framework/tools/mageui-exe-manifest-generation-and-editing-tool-graphical-client) diff --git a/dotnet-desktop-guide/framework/winforms/mouse-input-in-a-windows-forms-application.md b/dotnet-desktop-guide/framework/winforms/mouse-input-in-a-windows-forms-application.md index 92d05db..c41cc41 100644 --- a/dotnet-desktop-guide/framework/winforms/mouse-input-in-a-windows-forms-application.md +++ b/dotnet-desktop-guide/framework/winforms/mouse-input-in-a-windows-forms-application.md @@ -6,9 +6,11 @@ helpviewer_keywords: ms.assetid: 743c2f3c-219e-4a52-b6b8-2657096a2da6 --- # Mouse Input in a Windows Forms Application + Windows Forms includes a variety of mouse events and additional support for customized mouse cursors, mouse capture, and drag-and-drop behavior. ## In This Section + [How Mouse Input Works in Windows Forms](how-mouse-input-works-in-windows-forms.md) Provides information about the mouse events and how to get current information and system settings for the mouse. @@ -28,5 +30,6 @@ Windows Forms includes a variety of mouse events and additional support for cust Describes how to implement drag-and-drop behavior. ## Related Sections - [Accessing the Mouse](https://docs.microsoft.com/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-mouse) + + [Accessing the Mouse](/dotnet/visual-basic/developing-apps/programming/computer-resources/accessing-the-mouse) Lists topics for accessing the mouse using Visual Basic. diff --git a/dotnet-desktop-guide/framework/winforms/security-in-windows-forms-overview.md b/dotnet-desktop-guide/framework/winforms/security-in-windows-forms-overview.md index 85757c1..c0e51c0 100644 --- a/dotnet-desktop-guide/framework/winforms/security-in-windows-forms-overview.md +++ b/dotnet-desktop-guide/framework/winforms/security-in-windows-forms-overview.md @@ -13,20 +13,20 @@ ms.assetid: 4810dc9f-ea23-4ce1-8ea1-657f0ff1d820 Before the release of the .NET Framework, all code running on a user's computer had the same rights or permissions to access resources that a user of the computer had. For example, if the user was allowed to access the file system, the code was allowed to access the file system; if the user was allowed to access a database, the code was allowed to access that database. Although these rights or permissions may be acceptable for code in executables that the user has explicitly installed on the local computer, they may not be acceptable for potentially malicious code coming from the Internet or a local Intranet. This code should not be able to access the user's computer resources without permission. -The .NET Framework introduces an infrastructure called Code Access Security that lets you differentiate the permissions, or rights, that code has from the rights that the user has. By default, code coming from the Internet and the Intranet can only run in what is known as partial trust. Partial trust subjects an application to a series of restrictions: among other things, an application is restricted from accessing the local hard disk, and cannot run unmanaged code. The .NET Framework controls the resources that code is allowed to access based on the identity of that code: where it came from, whether it has a [Strong-Named Assemblies](https://docs.microsoft.com/dotnet/standard/assembly/strong-name), whether it is signed with a certificate, and so on. +The .NET Framework introduces an infrastructure called Code Access Security that lets you differentiate the permissions, or rights, that code has from the rights that the user has. By default, code coming from the Internet and the Intranet can only run in what is known as partial trust. Partial trust subjects an application to a series of restrictions: among other things, an application is restricted from accessing the local hard disk, and cannot run unmanaged code. The .NET Framework controls the resources that code is allowed to access based on the identity of that code: where it came from, whether it has a [Strong-Named Assemblies](/dotnet/standard/assembly/strong-name), whether it is signed with a certificate, and so on. ClickOnce technology, which you use to deploy Windows Forms applications, helps make it easier for you to develop applications that run in partial trust, in full trust, or in partial trust with elevated permissions. ClickOnce provides features such as Permission Elevation and Trusted Application Deployment so that your application can request full trust or elevated permissions from the local user in a responsible manner. ## Understanding Security in the .NET Framework -Code access security allows code to be trusted to varying degrees, depending on where the code originates and on other aspects of the code's identity. For more information about the evidence the common language runtime uses to determine security policy, see [Evidence](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/7y5x1hcd(v=vs.100)). It helps protect computer systems from malicious code and helps protect trusted code from intentionally or accidentally compromising security. Code access security also gives you more control over what actions your application can perform, because you can specify only those permissions you need your application to have. Code access security affects all managed code that targets the common language runtime, even if that code does not make a single code-access-security permission check. For more information about security in the .NET Framework, see [Key Security Concepts](https://docs.microsoft.com/dotnet/standard/security/key-security-concepts) and [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics). +Code access security allows code to be trusted to varying degrees, depending on where the code originates and on other aspects of the code's identity. For more information about the evidence the common language runtime uses to determine security policy, see [Evidence](/previous-versions/dotnet/netframework-4.0/7y5x1hcd(v=vs.100)). It helps protect computer systems from malicious code and helps protect trusted code from intentionally or accidentally compromising security. Code access security also gives you more control over what actions your application can perform, because you can specify only those permissions you need your application to have. Code access security affects all managed code that targets the common language runtime, even if that code does not make a single code-access-security permission check. For more information about security in the .NET Framework, see [Key Security Concepts](/dotnet/standard/security/key-security-concepts) and [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics). If the user run a Windows Forms executable file directly off of a Web server or a file share, the degree of trust granted to your application depends on where the code resides, and how it is started. When an application runs, it is automatically evaluated and it receives a named permission set from the common language runtime. By default, the code from the local computer is granted the Full Trust permission set, code from a local network is granted the Local Intranet permission set, and code from the Internet is granted the Internet permission set. > [!NOTE] > In the .NET Framework version 1.0 Service Pack 1 and Service Pack 2, the Internet zone code group receives the Nothing permission set. In all other releases of the .NET Framework, the Internet zone code group receives the Internet permissions set. > -> The default permissions granted in each of these permission sets are listed in the [Default Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) topic. Depending on the permissions that the application receives, it either runs correctly or generates a security exception. +> The default permissions granted in each of these permission sets are listed in the [Default Security Policy](/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) topic. Depending on the permissions that the application receives, it either runs correctly or generates a security exception. > > Many Windows Forms applications will be deployed using ClickOnce. The tools used for generating a ClickOnce deployment have different security defaults than what was discussed earlier. For more information, see the following discussion. @@ -34,7 +34,7 @@ The actual permissions granted to your application can be different from the def ## Developing a More Secure Windows Forms Application -Security is important in all steps of application development. Start by reviewing and following the [Secure Coding Guidelines](https://docs.microsoft.com/dotnet/standard/security/secure-coding-guidelines). +Security is important in all steps of application development. Start by reviewing and following the [Secure Coding Guidelines](/dotnet/standard/security/secure-coding-guidelines). Next, decide whether your application must run in full trust, or whether it should run in partial trust. Running your application in full trust makes it easier to access resources on the local computer, but exposes your application and its users to high security risks if you do not design and develop your application strictly according to the Secure Coding Guidelines topic. Running your application in partial trust makes it easier to develop a more secure application and reduces much risk, but requires more planning in how to implement certain features. @@ -42,7 +42,7 @@ If you choose partial trust (that is, either the Internet or Local Intranet perm If your application needs more permissions than partial trust allows, but you do not want to run in full trust, you can run in partial trust while asserting only those additional permissions you need. For example, if you want to run in partial trust, but must grant your application read-only access to a directory on the user's file system, you can request only for that directory. Used correctly, this approach can give your application increased functionality and minimize security risks to your users. -When you develop an application that will run in partial trust, keep track of what permissions your application must run and what permissions your application could optionally use. When all the permissions are known, you should make a declarative request for permission at the application level. Requesting permissions informs the .NET Framework run time about which permissions your application needs and which permissions it specifically does not want. For more information about requesting permissions, see [Requesting Permissions](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)). +When you develop an application that will run in partial trust, keep track of what permissions your application must run and what permissions your application could optionally use. When all the permissions are known, you should make a declarative request for permission at the application level. Requesting permissions informs the .NET Framework run time about which permissions your application needs and which permissions it specifically does not want. For more information about requesting permissions, see [Requesting Permissions](/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)). When you request optional permissions, you must handle security exceptions that will be generated if your application performs an action that requires permissions not granted to it. Appropriate handling of the will ensure that your application can continue to operate. Your application can use the exception to determine whether a feature should become disabled for the user. For example, an application can disable the **Save** menu option if the required file permission is not granted. @@ -71,7 +71,7 @@ The following table describes these technologies. Which technology you choose will depend on your deployment environment. For more information, see [Choosing a ClickOnce Deployment Strategy](/visualstudio/deployment/choosing-a-clickonce-deployment-strategy). -By default, ClickOnce applications deployed using either Visual Studio or the .NET Framework SDK tools (Mage.exe and MageUI.exe) are configured to run on a client computer that has Full Trust. If you are deploying your application by using partial trust or by using only some additional permissions, you will have to change this default. You can do this with either Visual Studio or the .NET Framework SDK tool MageUI.exe when you configure your deployment. For more information about how to use MageUI.exe, see [Walkthrough: Manually deploying a ClickOnce application](/visualstudio/deployment/walkthrough-manually-deploying-a-clickonce-application). Also see [How to: Set Custom Permissions for a ClickOnce Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2012/hafybdaa(v=vs.110)) or [How to: Set Custom Permissions for a ClickOnce Application](/visualstudio/deployment/how-to-set-custom-permissions-for-a-clickonce-application). +By default, ClickOnce applications deployed using either Visual Studio or the .NET Framework SDK tools (Mage.exe and MageUI.exe) are configured to run on a client computer that has Full Trust. If you are deploying your application by using partial trust or by using only some additional permissions, you will have to change this default. You can do this with either Visual Studio or the .NET Framework SDK tool MageUI.exe when you configure your deployment. For more information about how to use MageUI.exe, see [Walkthrough: Manually deploying a ClickOnce application](/visualstudio/deployment/walkthrough-manually-deploying-a-clickonce-application). Also see [How to: Set Custom Permissions for a ClickOnce Application](/previous-versions/visualstudio/visual-studio-2012/hafybdaa(v=vs.110)) or [How to: Set Custom Permissions for a ClickOnce Application](/visualstudio/deployment/how-to-set-custom-permissions-for-a-clickonce-application). For more information about the security aspects of ClickOnce and Permission Elevation, see [Securing ClickOnce Applications](/visualstudio/deployment/securing-clickonce-applications). For more information about Trusted Application Deployment, see [Trusted Application Deployment Overview](/visualstudio/deployment/trusted-application-deployment-overview). @@ -82,8 +82,8 @@ If you have deployed your Windows Forms application by using Visual Studio, you ## See also - [Windows Forms Security](windows-forms-security.md) -- [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics) +- [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics) - [ClickOnce Security and Deployment](/visualstudio/deployment/clickonce-security-and-deployment) - [Trusted Application Deployment Overview](/visualstudio/deployment/trusted-application-deployment-overview) -- [Mage.exe (Manifest Generation and Editing Tool)](https://docs.microsoft.com/dotnet/framework/tools/mage-exe-manifest-generation-and-editing-tool) -- [MageUI.exe (Manifest Generation and Editing Tool, Graphical Client)](https://docs.microsoft.com/dotnet/framework/tools/mageui-exe-manifest-generation-and-editing-tool-graphical-client) +- [Mage.exe (Manifest Generation and Editing Tool)](/dotnet/framework/tools/mage-exe-manifest-generation-and-editing-tool) +- [MageUI.exe (Manifest Generation and Editing Tool, Graphical Client)](/dotnet/framework/tools/mageui-exe-manifest-generation-and-editing-tool-graphical-client) diff --git a/dotnet-desktop-guide/framework/winforms/user-input-validation-in-windows-forms.md b/dotnet-desktop-guide/framework/winforms/user-input-validation-in-windows-forms.md index ec5a92a..7443fed 100644 --- a/dotnet-desktop-guide/framework/winforms/user-input-validation-in-windows-forms.md +++ b/dotnet-desktop-guide/framework/winforms/user-input-validation-in-windows-forms.md @@ -10,9 +10,11 @@ helpviewer_keywords: ms.assetid: 4ec07681-1dee-4bf9-be5e-718f635a33a1 --- # User Input Validation in Windows Forms + When users enter data into your application, you may want to verify that the data is valid before your application uses it. You may require that certain text fields not be zero-length, that a field be formatted as a telephone number or other type of well-formed data, or that a string not contain any unsafe characters that could be used to compromise the security of a database. Windows Forms provides several ways for you to validate input in your application. ## Validation with the MaskedTextBox Control + If you need to require users to enter data in a well-defined format, such as a telephone number or a part number, you can accomplish this quickly and with minimal code by using the control. A *mask* is a string made up of characters from a masking language that specifies which characters can be entered at any given position in the text box. The control displays a set of prompts to the user. If the user types an incorrect entry, for example, the user types a letter when a digit is required, the control will automatically reject the input. The masking language that is used by is very flexible. It allows you to specify required characters, optional characters, literal characters, such as hyphens and parentheses, currency characters, and date separators. The control also works well when bound to a data source. The event on a data binding can be used to reformat incoming data to comply with the mask, and the event can be used to reformat outgoing data to comply with the specifications of the data field. @@ -20,11 +22,12 @@ When users enter data into your application, you may want to verify that the dat For more information, see [MaskedTextBox Control](./controls/maskedtextbox-control-windows-forms.md). ## Event-Driven Validation + If you want full programmatic control over validation, or need to perform complex validation checks, you should use the validation events built into most Windows Forms controls. Each control that accepts free-form user input has a event that will occur whenever the control requires data validation. In the event-handling method, you can validate user input in several ways. For example, if you have a text box that must contain a postal code, you can perform the validation in the following ways: - If the postal code must belong to a specific group of zip codes, you can perform a string comparison on the input to validate the data entered by the user. For example, if the postal code must be in the set {10001, 10002, 10003}, then you can use a string comparison to validate the data. -- If the postal code must be in a specific form you can use regular expressions to validate the data entered by the user. For example, to validate the form `#####` or `#####-####`, you can use the regular expression `^(\d{5})(-\d{4})?$`. To validate the form `A#A #A#`, you can use the regular expression `[A-Z]\d[A-Z] \d[A-Z]\d`. For more information about regular expressions, see [.NET Framework Regular Expressions](https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions) and [Regular Expression Examples](https://docs.microsoft.com/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs). +- If the postal code must be in a specific form you can use regular expressions to validate the data entered by the user. For example, to validate the form `#####` or `#####-####`, you can use the regular expression `^(\d{5})(-\d{4})?$`. To validate the form `A#A #A#`, you can use the regular expression `[A-Z]\d[A-Z] \d[A-Z]\d`. For more information about regular expressions, see [.NET Framework Regular Expressions](/dotnet/standard/base-types/regular-expressions) and [Regular Expression Examples](/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs). - If the postal code must be a valid United States Zip code, you could call a Zip code Web service to validate the data entered by the user. @@ -33,6 +36,7 @@ When users enter data into your application, you may want to verify that the dat For a code example that validates an email address in a , see . ### Data Binding and Event-Driven Validation + Validation is very useful when you have bound your controls to a data source, such as a database table. By using validation, you can make sure that your control's data satisfies the format required by the data source, and that it does not contain any special characters such as quotation marks and back slashes that might be unsafe. When you use data binding, the data in your control is synchronized with the data source during execution of the event. If you cancel the event, the data will not be synchronized with the data source. @@ -41,9 +45,11 @@ When users enter data into your application, you may want to verify that the dat > If you have custom validation that takes place after the event, it will not affect the data binding. For example, if you have code in a event that attempts to cancel the data binding, the data binding will still occur. In this case, to perform validation in the event, change the control's **Data Source Update Mode** property (**under (Databindings)**\\**(Advanced)**) from **OnValidation** to **Never**, and add *Control*`.DataBindings["`*\*`"].WriteValue()` to your validation code. ### Implicit and Explicit Validation + So when does a control's data get validated? This is up to you, the developer. You can use either implicit or explicit validation, depending on the needs of your application. #### Implicit Validation + The implicit validation approach validates data as the user enters it. You can validate the data as the data is entered in a control by reading the keys as they are pressed, or more commonly whenever the user takes the input focus away from one control and moves to the next. This approach is useful when you want to give the user immediate feedback about the data as they are working. If you want to use implicit validation for a control, you must set that control's property to or . If you cancel the event, the behavior of the control will be determined by what value that you assigned to . If you assigned , canceling the event will cause the event not to occur. Input focus will remain on the current control until the user changes the data to a valid input. If you assigned , the event will not occur when you cancel the event, but focus will still change to the next control. @@ -51,6 +57,7 @@ When users enter data into your application, you may want to verify that the dat Assigning to the property prevents implicit validation altogether. To validate your controls, you will have to use explicit validation. #### Explicit Validation + The explicit validation approach validates data at one time. You can validate the data in response to a user action, such as clicking a Save button or a Next link. When the user action occurs, you can trigger explicit validation in one of the following ways: - Call to validate the last control to have lost focus. @@ -60,6 +67,7 @@ When users enter data into your application, you may want to verify that the dat - Call a custom method to validate the data in the controls manually. #### Default Implicit Validation Behavior for Windows Forms Controls + Different Windows Forms controls have different defaults for their property. The following table shows the most common controls and their defaults. |Control|Default Validation Behavior| @@ -72,6 +80,7 @@ When users enter data into your application, you may want to verify that the dat ||| ## Closing the Form and Overriding Validation + When a control maintains focus because the data it contains is invalid, it is impossible to close the parent form in one of the usual ways: - By clicking the **Close** button. @@ -91,4 +100,4 @@ When users enter data into your application, you may want to verify that the dat - - - [MaskedTextBox Control](./controls/maskedtextbox-control-windows-forms.md) -- [Regular Expression Examples](https://docs.microsoft.com/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs) +- [Regular Expression Examples](/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs) diff --git a/dotnet-desktop-guide/framework/winforms/windows-forms-accessibility-improvements.md b/dotnet-desktop-guide/framework/winforms/windows-forms-accessibility-improvements.md index 559c016..8d95d17 100644 --- a/dotnet-desktop-guide/framework/winforms/windows-forms-accessibility-improvements.md +++ b/dotnet-desktop-guide/framework/winforms/windows-forms-accessibility-improvements.md @@ -91,8 +91,8 @@ The following changes apply to the con ## UI automation support for DataGridView, PropertyGrid, ListBox, ComboBox, ToolStrip, and other controls -UI Automation support is enabled for controls at runtime but isn't used during design time. For an overview of UI automation, see the [UI Automation Overview](https://docs.microsoft.com/dotnet/framework/ui-automation/ui-automation-overview). +UI Automation support is enabled for controls at runtime but isn't used during design time. For an overview of UI automation, see the [UI Automation Overview](/dotnet/framework/ui-automation/ui-automation-overview). ## See also -- [Accessibility Best Practices](https://docs.microsoft.com/dotnet/framework/ui-automation/accessibility-best-practices). +- [Accessibility Best Practices](/dotnet/framework/ui-automation/accessibility-best-practices). diff --git a/dotnet-desktop-guide/framework/winforms/windows-forms-security.md b/dotnet-desktop-guide/framework/winforms/windows-forms-security.md index 81e819d..01ae8c0 100644 --- a/dotnet-desktop-guide/framework/winforms/windows-forms-security.md +++ b/dotnet-desktop-guide/framework/winforms/windows-forms-security.md @@ -11,9 +11,11 @@ helpviewer_keywords: ms.assetid: 932d438a-5285-46d8-a958-8c93d0ad6cae --- # Windows Forms Security + Windows Forms features a security model that is code-based (security levels are set for code, regardless of the user running the code). This is in addition to any security schemas that may be in place already on your computer system. These can include those in the browser (such as the zone-based security available in Internet Explorer) or the operating system (such as the credential-based security of Windows NT). ## In This Section + [Security in Windows Forms Overview](security-in-windows-forms-overview.md) Briefly explains the .NET Framework security model and the basic steps necessary to ensure the Windows Forms in your application are secure. @@ -27,29 +29,30 @@ Windows Forms features a security model that is code-based (security levels are Describes performing window manipulation, using the Clipboard, and making calls to unmanaged code in a semi-trusted environment. ## Related Sections - [Default Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) + + [Default Security Policy](/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) Lists the default permissions granted in the Full Trust, Local Intranet, and Internet permission sets. - [General Security Policy Administration](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)) + [General Security Policy Administration](/previous-versions/dotnet/netframework-4.0/ed5htz45(v=vs.100)) Gives information about the administering the .NET Framework security policy and elevating permissions. - [Dangerous Permissions and Policy Administration](https://docs.microsoft.com/dotnet/framework/misc/dangerous-permissions-and-policy-administration) + [Dangerous Permissions and Policy Administration](/dotnet/framework/misc/dangerous-permissions-and-policy-administration) Discusses some of the.NET Framework permissions that can potentially allow the security system to be circumvented. - [Secure Coding Guidelines](https://docs.microsoft.com/dotnet/standard/security/secure-coding-guidelines) + [Secure Coding Guidelines](/dotnet/standard/security/secure-coding-guidelines) Links to topics that explain the best practices for securely writing code against the .NET Framework. - [Requesting Permissions](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)) + [Requesting Permissions](/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)) Discusses the use of attributes to let the runtime know what permissions your code needs to run. - [Key Security Concepts](https://docs.microsoft.com/dotnet/standard/security/key-security-concepts) + [Key Security Concepts](/dotnet/standard/security/key-security-concepts) Links to topics that cover the basic aspects of code security. - [Code Access Security Basics](https://docs.microsoft.com/dotnet/framework/misc/code-access-security-basics) + [Code Access Security Basics](/dotnet/framework/misc/code-access-security-basics) Discusses the basics of working with the .NET Framework run time security policy. - [Determining When to Modify Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/xky659fc(v=vs.100)) + [Determining When to Modify Security Policy](/previous-versions/dotnet/netframework-4.0/xky659fc(v=vs.100)) Explains how to determine when your applications need to diverge from the default security policy. - [Deploying Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/13wcxx6y(v=vs.100)) + [Deploying Security Policy](/previous-versions/dotnet/netframework-4.0/13wcxx6y(v=vs.100)) Discusses the best manner for deploying security policy changes.