diff --git a/xml/System.Windows.Forms.Integration/WindowsFormsHost.xml b/xml/System.Windows.Forms.Integration/WindowsFormsHost.xml index 28e43eec2af..e88fb817fdc 100644 --- a/xml/System.Windows.Forms.Integration/WindowsFormsHost.xml +++ b/xml/System.Windows.Forms.Integration/WindowsFormsHost.xml @@ -59,7 +59,7 @@ ## XAML Object Element Usage -``` +```xaml ``` @@ -168,8 +168,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -350,8 +350,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` ]]> @@ -503,8 +503,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -589,8 +589,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -673,8 +673,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -758,8 +758,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -843,8 +843,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -936,8 +936,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` ]]> @@ -1096,8 +1096,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` @@ -1282,8 +1282,8 @@ The following code example demonstrates how to use a ## XAML Attribute Usage -``` - +```xaml + ``` diff --git a/xml/System.Windows.Forms/BindingContext.xml b/xml/System.Windows.Forms/BindingContext.xml index 9e07c94cb00..f341090e010 100644 --- a/xml/System.Windows.Forms/BindingContext.xml +++ b/xml/System.Windows.Forms/BindingContext.xml @@ -41,108 +41,98 @@ Manages the collection of objects for any object that inherits from the class. - object that manages the objects for the form. Because the class is abstract, the return type of the property is either a or a . If the data source is an object that can return only a single property (instead of a list of objects), the is a . For example, if you specify a as the data source, a is returned. On the other hand, if the data source is an object that implements or , a is returned. - - For each data source on a Windows Form, there is a single or . Because there may be multiple data sources associated with a Windows Form, the enables you to retrieve any particular associated with a data source. - + object that manages the objects for the form. Because the class is abstract, the return type of the property is either a or a . If the data source is an object that can return only a single property (instead of a list of objects), the is a . For example, if you specify a as the data source, a is returned. On the other hand, if the data source is an object that implements or , a is returned. + + For each data source on a Windows Form, there is a single or . Because there may be multiple data sources associated with a Windows Form, the enables you to retrieve any particular associated with a data source. + > [!NOTE] -> When using the property, the creates a new if one does not already exist. This can lead to some confusion, as the returned object may not manage the list (or any list) that you intend. To prevent returning an invalid , use the method to determine if the intended already exists. - - If you use a container control, such as a , , or , to contain data-bound controls, you can create a for just that container control and its controls. Then, each part of your form can be managed by its own . See the constructor for more information about creating multiple objects for the same data source. - - If you add a control to a form and bind it to a column of a table in a dataset, the control communicates with the of that form. The , in turn, talks to the specific for that data association. If you queried the `Position` property of the , it would report the current record for the binding of that control. In the following code example, a control is bound to the `FirstName` column of a `Customers` table on the `dataSet1` dataset through the for the form it is on. - -```vb -TextBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName") - -``` - -```csharp -textBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName"); - -``` - -```cpp -textBox1->DataBindings->Add("Text", dataSet1, "Customers.FirstName"); -``` - - You can add a second control (`TextBox2`) to the form and bind it to the `LastName` column of the `Customers` table in the same dataset. The is aware of the first binding (`TextBox1` to `Customers.FirstName`), so it would use the same , as both text boxes are bound to the same dataset (`DataSet1`). - -```vb -TextBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName") - -``` - -```csharp -textBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName"); - -``` - -```cpp -textBox2->DataBindings->Add("Text", dataSet1, "Customers.LastName"); -``` - - If you bind `TextBox2` to a different dataset, the creates and manages a second . - - It is important to be consistent about how you set the and properties; otherwise, the creates multiple currency managers for the same dataset, which results in errors. The following code example shows a few ways to set the properties and their associated objects. You can set the properties using either of the following methods, as long as you are consistent throughout your code. - -```vb -ComboBox1.DataSource = DataSet1 -ComboBox1.DisplayMember = "Customers.FirstName" -Me.BindingContext(dataSet1, "Customers").Position = 1 - -``` - -```csharp -comboBox1.DataSource = DataSet1; -comboBox1.DisplayMember = "Customers.FirstName"; -this.BindingContext[dataSet1, "Customers"].Position = 1; - -``` - -```cpp -comboBox1->DataSource = dataSet1; -comboBox1->DisplayMember = "Customers.FirstName"; -this->BindingContext->get_Item(dataSet1, "Customers")->Position = 1; - -``` - -```vb -ComboBox1.DataSource = DataSet1.Customers -ComboBox1.DisplayMember = "FirstName" -Me.BindingContext(dataSet1.Customers).Position = 1 - -``` - -```csharp -comboBox1.DataSource = DataSet1.Customers; -comboBox1.DisplayMember = "FirstName"; -this.BindingContext[dataSet1.Customers].Position = 1; - -``` - -```cpp -comboBox1->DataSource = dataSet1->Customers; -comboBox1->DisplayMember = "FirstName"; -this->BindingContext->get_Item(dataSet1->Customers)->Position = 1; - -``` - +> When using the property, the creates a new if one does not already exist. This can lead to some confusion, as the returned object may not manage the list (or any list) that you intend. To prevent returning an invalid , use the method to determine if the intended already exists. + + If you use a container control, such as a , , or , to contain data-bound controls, you can create a for just that container control and its controls. Then, each part of your form can be managed by its own . See the constructor for more information about creating multiple objects for the same data source. + + If you add a control to a form and bind it to a column of a table in a dataset, the control communicates with the of that form. The , in turn, talks to the specific for that data association. If you queried the `Position` property of the , it would report the current record for the binding of that control. In the following code example, a control is bound to the `FirstName` column of a `Customers` table on the `dataSet1` dataset through the for the form it is on. + +```vb +TextBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName") +``` + +```csharp +textBox1.DataBindings.Add("Text", dataSet1, "Customers.FirstName"); +``` + +```cpp +textBox1->DataBindings->Add("Text", dataSet1, "Customers.FirstName"); +``` + + You can add a second control (`TextBox2`) to the form and bind it to the `LastName` column of the `Customers` table in the same dataset. The is aware of the first binding (`TextBox1` to `Customers.FirstName`), so it would use the same , as both text boxes are bound to the same dataset (`DataSet1`). + +```vb +TextBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName") +``` + +```csharp +textBox2.DataBindings.Add("Text", dataSet1, "Customers.LastName"); +``` + +```cpp +textBox2->DataBindings->Add("Text", dataSet1, "Customers.LastName"); +``` + + If you bind `TextBox2` to a different dataset, the creates and manages a second . + + It is important to be consistent about how you set the and properties; otherwise, the creates multiple currency managers for the same dataset, which results in errors. The following code example shows a few ways to set the properties and their associated objects. You can set the properties using either of the following methods, as long as you are consistent throughout your code. + +```vb +ComboBox1.DataSource = DataSet1 +ComboBox1.DisplayMember = "Customers.FirstName" +Me.BindingContext(dataSet1, "Customers").Position = 1 +``` + +```csharp +comboBox1.DataSource = DataSet1; +comboBox1.DisplayMember = "Customers.FirstName"; +this.BindingContext[dataSet1, "Customers"].Position = 1; +``` + +```cpp +comboBox1->DataSource = dataSet1; +comboBox1->DisplayMember = "Customers.FirstName"; +this->BindingContext->get_Item(dataSet1, "Customers")->Position = 1; +``` + +```vb +ComboBox1.DataSource = DataSet1.Customers +ComboBox1.DisplayMember = "FirstName" +Me.BindingContext(dataSet1.Customers).Position = 1 +``` + +```csharp +comboBox1.DataSource = DataSet1.Customers; +comboBox1.DisplayMember = "FirstName"; +this.BindingContext[dataSet1.Customers].Position = 1; +``` + +```cpp +comboBox1->DataSource = dataSet1->Customers; +comboBox1->DisplayMember = "FirstName"; +this->BindingContext->get_Item(dataSet1->Customers)->Position = 1; +``` + > [!NOTE] -> Most Windows Forms applications bind through a . The component encapsulates a and exposes the programming interface. When using a for binding, you should use the members exposed by the to manipulate "currency" (that is, `Position`) rather than go through the . - - - -## Examples - The following code example creates four objects to bind five controls - a and four controls - to several data sources. The is then used to get the for each data source. - +> Most Windows Forms applications bind through a . The component encapsulates a and exposes the programming interface. When using a for binding, you should use the members exposed by the to manipulate "currency" (that is, `Position`) rather than go through the . + + + +## Examples + The following code example creates four objects to bind five controls - a and four controls - to several data sources. The is then used to get the for each data source. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -179,20 +169,20 @@ this->BindingContext->get_Item(dataSet1->Customers)->Position = 1; Initializes a new instance of the class. - instances for the same data source, create a new and set it to the property of an object that inherits from the class. For example, if you have two objects (from two different objects), you can set the properties of each to different values. This causes each set of data-bound controls to display different values from the same data source. - - - -## Examples - The following code example creates two new objects and assigns each object to the property of a control. `GroupBox1` contains `TextBox1`, and `GroupBox2` contains `TextBox2` (which is accomplished by using the method of the class). The example then adds objects to the two controls, binding each to the same data source and data member. The example also shows two event handlers that use the from the controls to set the property on different objects. - + instances for the same data source, create a new and set it to the property of an object that inherits from the class. For example, if you have two objects (from two different objects), you can set the properties of each to different values. This causes each set of data-bound controls to display different values from the same data source. + + + +## Examples + The following code example creates two new objects and assigns each object to the property of a control. `GroupBox1` contains `TextBox1`, and `GroupBox2` contains `TextBox2` (which is accomplished by using the method of the class). The example then adds objects to the two controls, binding each to the same data source and data member. The example also shows two event handlers that use the from the controls to set the property on different objects. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/.ctor/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -281,10 +271,10 @@ This method is obsolete and unused. ]]> - is . - - -or- - + is . + + -or- + is . @@ -403,11 +393,11 @@ This method is obsolete and unused. Always raises a when handled. - event is obsolete and always raises a when handled. For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/). - + event is obsolete and always raises a when handled. For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/). + ]]> Occurs in all cases. @@ -460,22 +450,22 @@ This method is obsolete and unused. if the contains the specified ; otherwise, . - class for a list of possible data sources and information about creating bindings between controls and data sources. - - See the property for information about returning a using only a data source. - - - -## Examples - The following code example uses the method to determine whether a exists for each control on a form. The example passes each in a to the method. - + class for a list of possible data sources and information about creating bindings between controls and data sources. + + See the property for information about returning a using only a data source. + + + +## Examples + The following code example uses the method to determine whether a exists for each control on a form. The example passes each in a to the method. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/Contains/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.Contains Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.Contains Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -523,22 +513,22 @@ This method is obsolete and unused. if the contains the specified ; otherwise, . - class for a list of possible data sources and for information about creating bindings between controls and data sources. - - See the property for information about returning a using a data source and data member. - - - -## Examples - The following code example uses the method to test whether a specific exists before attempting to get it through the property. - + class for a list of possible data sources and for information about creating bindings between controls and data sources. + + See the property for information about returning a using a data source and data member. + + + +## Examples + The following code example uses the method to test whether a specific exists before attempting to get it through the property. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/Contains/source1.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -572,11 +562,11 @@ This method is obsolete and unused. if the collection is read-only; otherwise, . - , and is overridden to always return `false`. - + , and is overridden to always return `false`. + ]]> @@ -627,25 +617,25 @@ This method is obsolete and unused. Gets the that is associated with the specified data source. A for the specified data source. - you want does not require a navigation path. For example, if the manages a set of objects that use an or as the , no navigation path is required. - + you want does not require a navigation path. For example, if the manages a set of objects that use an or as the , no navigation path is required. + > [!NOTE] -> The property will always return a , and never return `null`. - - See the class for a list of possible data sources and for information about creating bindings between controls and data sources. - - - -## Examples - The following code example returns three objects: one for a , one for an , and one for the of a that belongs to a control. - +> The property will always return a , and never return `null`. + + See the class for a list of possible data sources and for information about creating bindings between controls and data sources. + + + +## Examples + The following code example returns three objects: one for a , one for an , and one for the of a that belongs to a control. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/Item/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.this Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.this Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -699,39 +689,39 @@ This method is obsolete and unused. Gets a that is associated with the specified data source and data member. The for the specified data source and data member. - manages a set of objects for which the data source contains multiple objects. For example, a can contain several objects linked by objects. In such a case, the navigation path is required to enable the to return the correct . - + manages a set of objects for which the data source contains multiple objects. For example, a can contain several objects linked by objects. In such a case, the navigation path is required to enable the to return the correct . + > [!NOTE] -> The property will always return a , when the `dataMember` parameter is valid. It will never return `null`. - - See the class for a list of possible data sources and for information about creating bindings between controls and data sources. - - If the desired manages a list, the navigation path must also end with a list. For example, the following C# code binds a control to the order date in a table of orders. The navigation path includes the , the , and the . However, the must be retrieved using only the and (which resolves to a list). - -``` -// The navigation path for a Binding ends with a property. -textBox1.DataBindings.Add -("Text", dataSet1, "Customers.custToOrders.OrderDate"); -// The navigation path for the BindingManagerBase ends with a list. -BindingManagerBase bmOrders = this.BindingContext -[dataSet1, "Customers.custToOrders"]; -``` - - When returning a , you should use the same data source as the and modify only the navigation path. - - Use the method to determine if the desired already exists. - - - -## Examples - The following code example demonstrates how to use the to retrieve the for a particular binding. It also shows how to handle the event for the to ensure multiple controls bound to the same data source remain synchronized when one of the control values is changed. To run this example, paste the code into a Windows Form and call the `InitializeControlsAndData` method from the form's constructor or event-handling method. - +> The property will always return a , when the `dataMember` parameter is valid. It will never return `null`. + + See the class for a list of possible data sources and for information about creating bindings between controls and data sources. + + If the desired manages a list, the navigation path must also end with a list. For example, the following C# code binds a control to the order date in a table of orders. The navigation path includes the , the , and the . However, the must be retrieved using only the and (which resolves to a list). + +```csharp +// The navigation path for a Binding ends with a property. +textBox1.DataBindings.Add +("Text", dataSet1, "Customers.custToOrders.OrderDate"); +// The navigation path for the BindingManagerBase ends with a list. +BindingManagerBase bmOrders = this.BindingContext +[dataSet1, "Customers.custToOrders"]; +``` + + When returning a , you should use the same data source as the and modify only the navigation path. + + Use the method to determine if the desired already exists. + + + +## Examples + The following code example demonstrates how to use the to retrieve the for a particular binding. It also shows how to handle the event for the to ensure multiple controls bound to the same data source remain synchronized when one of the control values is changed. To run this example, paste the code into a Windows Form and call the `InitializeControlsAndData` method from the form's constructor or event-handling method. + :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingCompleteEventArgs/Binding/Form1.cs" id="Snippet11"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.BindingSourceMultipleControls/VB/Form1.vb" id="Snippet11"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.BindingSourceMultipleControls/VB/Form1.vb" id="Snippet11"::: + ]]> The specified does not exist within the data source. @@ -769,13 +759,13 @@ BindingManagerBase bmOrders = this.BindingContext A that contains the event data. Raises the event. - method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. - + method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. + ]]> @@ -898,13 +888,13 @@ This method is obsolete and unused. The collection index to begin copying from. Copies the elements of the collection into a specified array, starting at the collection index. - @@ -938,15 +928,15 @@ This method is obsolete and unused. Gets the total number of objects managed by the . The number of data sources managed by the . - objects managed by the . - + objects managed by the . + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/System.Collections.ICollection.Count/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -981,11 +971,11 @@ This method is obsolete and unused. if the collection is thread safe; otherwise, . - , and is overridden to always return `false`. - + , and is overridden to always return `false`. + ]]> @@ -1060,20 +1050,20 @@ This member is an explicit interface member implementation. It can be used only Gets an enumerator for the collection. An for the collection. - returned by the method allows you to iterate over the collection managed by the . - - - -## Examples - The following code example uses the method to return an for the . - + returned by the method allows you to iterate over the collection managed by the . + + + +## Examples + The following code example uses the method to return an for the . + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/BindingContext/System.Collections.IEnumerable.GetEnumerator/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -1117,11 +1107,11 @@ This member is an explicit interface member implementation. It can be used only The to associate with the new . Associates a with a new . - , when their changes. - + , when their changes. + ]]> diff --git a/xml/System.Windows.Forms/ComboBox.xml b/xml/System.Windows.Forms/ComboBox.xml index 58c5e85514d..5b3c8f477e7 100644 --- a/xml/System.Windows.Forms/ComboBox.xml +++ b/xml/System.Windows.Forms/ComboBox.xml @@ -1754,9 +1754,9 @@ ## Remarks Starting with the .NET Framework 4.5.2, if the property is set to or , the drop-down arrow may be resized. Resizing is determined by the system DPI setting when the app.config file contains the following entry: -``` +```xml + ``` diff --git a/xml/System.Windows.Forms/Control.xml b/xml/System.Windows.Forms/Control.xml index 02b110b7fe7..85b21b56a24 100644 --- a/xml/System.Windows.Forms/Control.xml +++ b/xml/System.Windows.Forms/Control.xml @@ -5557,19 +5557,14 @@ The following table lists Windows Forms controls and which event ( and properties of the are in screen coordinates, not client coordinates. The following line of Visual C# code converts the properties to a client . + The and properties of the are in screen coordinates, not client coordinates. The following line of code converts the properties to a client . -``` +```csharp Point clientPoint = targetControl.PointToClient(new Point(de.X, de.Y)); ``` -> [!NOTE] -> In versions earlier than .NET Framework 2.0, if you put a with and events on a Windows Form and drag and drop something onto the at design time, the `DropDrop` and `DropEnter` events are raised. However, when you close and reopen the solution, the and events are not raised again. - For more information about handling events, see [Handling and Raising Events](/dotnet/standard/events/). - - ## Examples This code excerpt demonstrates using the event. See the method for the complete code example. @@ -8488,7 +8483,7 @@ MyControl.Font = New Font(MyControl.Font, _ - If no parameters are passed, the sender parameter will contain this control and the event parameter will contain . - When a single parameter is passed, the sender parameter will contain the first args element and the event parameter will contain . - If more than one parameter is passed, the sender parameter will contain the first element from `args`, and the parameter will contain the second element. - + A call to an or delegate will be faster than a call to another type of delegate. > [!NOTE] @@ -8575,11 +8570,11 @@ MyControl.Font = New Font(MyControl.Font, _ A task that represents the asynchronous invoke operation. - When you pass a to this method, the method will return, but the callback will still be executed. + When you pass a to this method, the method will return, but the callback will still be executed. The callback will be running on the UI thread and will be also blocking the UI thread. InvokeAsync in this case is just queuing the callback to the end of the message queue and returns immediately, but as soon as the callback gets executed, it will still block the UI thread for the time it is running. For this reason, it is recommended to only execute short sync running operations in the callback, like updating a control's property or similar. - If you want to execute a long-running operation, consider using asynchronous callbacks instead, by making sure that you use either the overload + If you want to execute a long-running operation, consider using asynchronous callbacks instead, by making sure that you use either the overload or . @@ -8716,12 +8711,12 @@ MyControl.Font = New Font(MyControl.Font, _ When you pass a to this method, the method will return, but the callback will still be executed. The callback will be running on the UI thread and will be also blocking the UI thread. - InvokeAsync in this case is just queuing the callback to the end of the message queue and returns immediately, but as soon as the callback is executed, it will still block the UI for the time it is running. For this reason, it is recommended to only + InvokeAsync in this case is just queuing the callback to the end of the message queue and returns immediately, but as soon as the callback is executed, it will still block the UI for the time it is running. For this reason, it is recommended to only execute short sync running operations in the callback, like updating a control's property or similar. If you want to execute a long-running operation, consider using asynchronous callbacks instead, which you use with the overloads of InvokeAsync described below. - Important: Also note that if you use this overload to pass a callback which returns a that this Task will NOT be awaited but return immediately and has the characteristics of an "engage-and-forget". + Important: Also note that if you use this overload to pass a callback which returns a that this Task will NOT be awaited but return immediately and has the characteristics of an "engage-and-forget". If you want the task which you pass to be awaited, make sure that you use either the overload or . @@ -17058,7 +17053,7 @@ if (CanSelect && IsMnemonic(charCode, MyControl.Text) { ## Remarks The property is a read-only property. To change the value of this property, set the property value of the . The following line of C# code sets the property. -``` +```csharp [assembly: AssemblyProduct("MyApplication")] ``` @@ -17133,7 +17128,7 @@ if (CanSelect && IsMnemonic(charCode, MyControl.Text) { ## Remarks The property is a read-only property. To change the value of this property, set the property value of the . The following line of C# code sets the property. -``` +```csharp [assembly: AssemblyVersion("1.0.1")] ``` diff --git a/xml/System.Windows.Forms/Cursor.xml b/xml/System.Windows.Forms/Cursor.xml index 13d293f0666..8f10c9c7a41 100644 --- a/xml/System.Windows.Forms/Cursor.xml +++ b/xml/System.Windows.Forms/Cursor.xml @@ -58,47 +58,47 @@ Represents the image used to paint the mouse pointer. - cursor is typically displayed. A wait cursor is commonly used to inform the user that a process is currently running. Examples of processes you might have the user wait for are opening a file, saving a file, or filling a control such as a , or with a large amount of data. - - All controls that derive from the class have a property. To change the cursor displayed by the mouse pointer when it is within the bounds of the control, assign a to the property of the control. Alternatively, you can display cursors at the application level by assigning a to the property. For example, if the purpose of your application is to edit a text file, you might set the property to to display a wait cursor over the application while the file loads or saves to prevent any mouse events from being processed. When the process is complete, set the property to for the application to display the appropriate cursor over each control type. - + cursor is typically displayed. A wait cursor is commonly used to inform the user that a process is currently running. Examples of processes you might have the user wait for are opening a file, saving a file, or filling a control such as a , or with a large amount of data. + + All controls that derive from the class have a property. To change the cursor displayed by the mouse pointer when it is within the bounds of the control, assign a to the property of the control. Alternatively, you can display cursors at the application level by assigning a to the property. For example, if the purpose of your application is to edit a text file, you might set the property to to display a wait cursor over the application while the file loads or saves to prevent any mouse events from being processed. When the process is complete, set the property to for the application to display the appropriate cursor over each control type. + > [!NOTE] -> If you call before resetting the property back to the cursor, the application will resume listening for mouse events and will resume displaying the appropriate for each control in the application. - - Cursor objects can be created from several sources, such as the handle of an existing , a standard file, a resource, or a data stream. - +> If you call before resetting the property back to the cursor, the application will resume listening for mouse events and will resume displaying the appropriate for each control in the application. + + Cursor objects can be created from several sources, such as the handle of an existing , a standard file, a resource, or a data stream. + > [!NOTE] -> The class does not support animated cursors (.ani files) or cursors with colors other than black and white. - - If the image you are using as a cursor is too small, you can use the method to force the image to fill the bounds of the cursor. You can temporarily hide the cursor by calling the method, and restore it by calling the method. - - Starting with the .NET Framework 4.5.2, the will be resized based on the system DPI setting when the app.config file contains the following entry: - -``` - - -``` - - - -## Examples - The following code example displays a form that demonstrates using a custom cursor. The custom is embedded in the application's resource file. The example requires a cursor contained in a cursor file named `MyCursor.cur`. To compile this example using the command line, include the following flag: `/res:MyCursor.Cur, CustomCursor.MyCursor.Cur` - +> The class does not support animated cursors (.ani files) or cursors with colors other than black and white. + + If the image you are using as a cursor is too small, you can use the method to force the image to fill the bounds of the cursor. You can temporarily hide the cursor by calling the method, and restore it by calling the method. + + Starting with the .NET Framework 4.5.2, the will be resized based on the system DPI setting when the app.config file contains the following entry: + +```xml + + + +``` + + + +## Examples + The following code example displays a form that demonstrates using a custom cursor. The custom is embedded in the application's resource file. The example requires a cursor contained in a cursor file named `MyCursor.cur`. To compile this example using the command line, include the following flag: `/res:MyCursor.Cur, CustomCursor.MyCursor.Cur` + :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/Overview/customcursor.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor/VB/customcursor.vb" id="Snippet1"::: - - The following code example displays customer information in a control. The root tree nodes display customer names, and the child tree nodes display the order numbers assigned to each customer. In this example, 1,000 customers are displayed with 15 orders each. The repainting of the is suppressed by using the and methods, and a wait is displayed while the creates and paints the objects. This example requires that you have a cursor file named `MyWait.cur` in the application directory. It also requires a `Customer` object that can hold a collection of `Order` objects, and that you have created an instance of a control on a . - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor/VB/customcursor.vb" id="Snippet1"::: + + The following code example displays customer information in a control. The root tree nodes display customer names, and the child tree nodes display the order numbers assigned to each customer. In this example, 1,000 customers are displayed with 15 orders each. The repainting of the is suppressed by using the and methods, and a wait is displayed while the creates and paints the objects. This example requires that you have a cursor file named `MyWait.cur` in the application directory. It also requires a `Customer` object that can hold a collection of `Order` objects, and that you have created an instance of a control on a . + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/Overview/treeview.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/TreeView/VB/treeview.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/TreeView/VB/treeview.vb" id="Snippet1"::: + ]]> @@ -140,20 +140,20 @@ An that represents the Windows handle of the cursor to create. Initializes a new instance of the class from the specified Windows handle. - cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires that you have a and a to call this code when it is clicked. - + cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires that you have a and a to call this code when it is clicked. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: + ]]> @@ -187,23 +187,23 @@ The data stream to load the from. Initializes a new instance of the class from the specified data stream. - [!NOTE] -> Animated cursors (.ani files) are not supported by the class. - - - -## Examples - The following code example loads a cursor from a created by the method of an . When the method is called, an is displayed to the user and when a. CUR file is selected and the dialog closed, the file is opened and the returned is used to create a . - +> Animated cursors (.ani files) are not supported by the class. + + + +## Examples + The following code example loads a cursor from a created by the method of an . When the method is called, an is displayed to the user and when a. CUR file is selected and the dialog closed, the file is opened and the returned is used to create a . + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/mycursor.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet1"::: + ]]> @@ -236,23 +236,23 @@ The cursor file to load. Initializes a new instance of the class from the specified file. - [!NOTE] -> Animated cursors (.ani files) are not supported by the class. - - - -## Examples - The following code example displays customer information in a control. The root tree nodes display customer names, and the child tree nodes display the order numbers assigned to each customer. In this example, 1,000 customers are displayed with 15 orders each. The repainting of the is suppressed by using the and methods, and a wait is displayed while the creates and paints the objects. This example requires that you have a `Customer` object that can hold a collection of `Order` objects. It also requires that you have created an instance of a control on a . - +> Animated cursors (.ani files) are not supported by the class. + + + +## Examples + The following code example displays customer information in a control. The root tree nodes display customer names, and the child tree nodes display the order numbers assigned to each customer. In this example, 1,000 customers are displayed with 15 orders each. The repainting of the is suppressed by using the and methods, and a wait is displayed while the creates and paints the objects. This example requires that you have a `Customer` object that can hold a collection of `Order` objects. It also requires that you have created an instance of a control on a . + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/Overview/treeview.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/TreeView/VB/treeview.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/TreeView/VB/treeview.vb" id="Snippet1"::: + ]]> @@ -286,29 +286,27 @@ The name of the resource. Initializes a new instance of the class from the specified resource with the specified resource type. - [!NOTE] -> The resource reference when compiling as well as when referencing it in code, is case sensitive for both the C# and Visual Basic compilers. - - - -## Examples - The following code example displays a form that demonstrates using a custom cursor by using the constructor. The custom is embedded in the application's resource file. The example requires that you have a cursor contained in a cursor file named `MyCursor.cur`. To compile this example using the command line, include the following flag: `/res:MyCursor.Cur, CustomCursor.MyCursor.Cur` - +> The resource reference when compiling as well as when referencing it in code, is case sensitive for both the C# and Visual Basic compilers. + +## Examples + The following code example displays a form that demonstrates using a custom cursor by using the constructor. The custom is embedded in the application's resource file. The example requires that you have a cursor contained in a cursor file named `MyCursor.cur`. To compile this example using the command line, include the following flag: `/res:MyCursor.Cur, CustomCursor.MyCursor.Cur` + :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/Overview/customcursor.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor/VB/customcursor.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor/VB/customcursor.vb" id="Snippet1"::: + ]]> @@ -346,20 +344,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets or sets the bounds that represent the clipping rectangle for the cursor. The that represents the clipping rectangle for the , in screen coordinates. - cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires that you have a and a to call this code when it is clicked. - + cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires that you have a and a to call this code when it is clicked. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: + ]]> @@ -392,11 +390,11 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Copies the handle of this . An that represents the cursor's handle. - @@ -438,11 +436,11 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets or sets a cursor object that represents the mouse cursor. A that represents the mouse cursor. The default is if the mouse cursor is not visible. - property changes the cursor currently displayed. The application may or may not continue to listen for mouse events. To signal that the application should not respond to mouse events during a long-running operation, use the property. In most cases, however, it's better to use a background thread to manage a long-running operation, and leave your user interface accessible to the user. For more information on easily implementing a background task, see . - + property changes the cursor currently displayed. The application may or may not continue to listen for mouse events. To signal that the application should not respond to mouse events during a long-running operation, use the property. In most cases, however, it's better to use a background thread to manage a long-running operation, and leave your user interface accessible to the user. For more information on easily implementing a background task, see . + ]]> @@ -478,23 +476,23 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Releases all resources used by the . - when you are finished using the . The `Dispose` method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged) and [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose). - + when you are finished using the . The `Dispose` method leaves the in an unusable state. After calling , you must release all references to the so the garbage collector can reclaim the memory that the was occupying. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged) and [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose). + > [!NOTE] -> Always call before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector frees it. - - - -## Examples - The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a to pass into the method when it is called. - +> Always call before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector frees it. + + + +## Examples + The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> @@ -531,20 +529,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb The that represents the bounds of the . Draws the cursor on the specified surface, within the specified bounds. - does not contain information about how to render a given image, so it passes the call to the . The method crops the image to the given dimensions and allows you to specify a within which to draw the . This method is typically used if you want to draw the cursor on a Graphics surface. For example, you might have a dialog that allows the user to select cursors from a control, or a group of controls. - - - -## Examples - The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires that you have a and a object to pass into the method when it is called. - + does not contain information about how to render a given image, so it passes the call to the . The method crops the image to the given dimensions and allows you to specify a within which to draw the . This method is typically used if you want to draw the cursor on a Graphics surface. For example, you might have a dialog that allows the user to select cursors from a control, or a group of controls. + + + +## Examples + The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires that you have a and a object to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> @@ -582,20 +580,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb The that represents the bounds of the . Draws the cursor in a stretched format on the specified surface, within the specified bounds. - object does not contain information about how to render a given image, so it passes the call to the object. The method stretches the image to fill the specified when the cursor is drawn. - - - -## Examples - The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires that you have a and a object to pass into the method when it is called. - + object does not contain information about how to render a given image, so it passes the call to the object. The method stretches the image to fill the specified when the cursor is drawn. + + + +## Examples + The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires that you have a and a object to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> @@ -634,15 +632,15 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb if this cursor is equal to the specified ; otherwise, . - cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. - + cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: + ]]> @@ -734,20 +732,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets the handle of the cursor. An that represents the cursor's handle. - cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. - + cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: + ]]> The handle value is . @@ -781,20 +779,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Hides the cursor. - and method calls must be balanced. For every call to the method there must be a corresponding call to the method. - - - -## Examples - The following code example hides the cursor when the mouse pointer enters the button's client area. Likewise, when the mouse pointer leaves the button's client area, the cursor is shown again. This example requires a with a named `myButton`. - + and method calls must be balanced. For every call to the method there must be a corresponding call to the method. + + + +## Examples + The following code example hides the cursor when the mouse pointer enters the button's client area. Likewise, when the mouse pointer leaves the button's client area, the cursor is shown again. This example requires a with a named `myButton`. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/mycursor.cs" id="Snippet3"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet3"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet3"::: + ]]> @@ -826,11 +824,11 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets the cursor hot spot. A representing the cursor hot spot. - is the in the cursor that interacts with other elements on the screen. - + is the in the cursor that interacts with other elements on the screen. + ]]> @@ -870,15 +868,15 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb if two instances of the class are equal; otherwise, . - - -## Examples - The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a object to pass into the method when it is called. - + + +## Examples + The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a object to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> @@ -919,15 +917,15 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb if two instances of the class are not equal; otherwise, . - - -## Examples - The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a to pass into the method when it is called. - + + +## Examples + The following code example draws the specified cursor on the form in its normal size, and in stretched mode, twice its size. This example requires a and a to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> @@ -960,20 +958,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets or sets the cursor's position. A that represents the cursor's position in screen coordinates. - property is identical to the property. - - - -## Examples - The following code example creates a cursor from the cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. - + property is identical to the property. + + + +## Examples + The following code example creates a cursor from the cursor's , changes its position and clipping rectangle. The result is the cursor will move up and to the left 50 pixels from where it is when the code is executed. Additionally, the cursor's clipping rectangle is changed to the bounds of the form (by default it is the user's whole screen). This example requires a and a to call this code when it is clicked. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet1"::: + ]]> @@ -1006,20 +1004,20 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Displays the cursor. - and method calls must be balanced. For every call to the method there must be a corresponding call to the method. - - - -## Examples - The following code example hides the cursor when the mouse pointer enters the button's client area. Likewise, when the mouse pointer leaves the button's client area, the cursor is shown again. This example requires a with a named `myButton`. - + and method calls must be balanced. For every call to the method there must be a corresponding call to the method. + + + +## Examples + The following code example hides the cursor when the mouse pointer enters the button's client area. Likewise, when the mouse pointer leaves the button's client area, the cursor is shown again. This example requires a with a named `myButton`. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp" id="Snippet3"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/mycursor.cs" id="Snippet3"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet3"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/CursorFromResource/VB/mycursor.vb" id="Snippet3"::: + ]]> @@ -1052,15 +1050,15 @@ vbc /resource:"MyWaitCursor.cur","MyCursors.MyWaitCursor.cur" MyCursor.vb Gets the size of the cursor object. A that represents the width and height of the . - and a object to pass into the method when it is called. - + and a object to pass into the method when it is called. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp" id="Snippet2"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Cursor/.ctor/cursorstuff.cs" id="Snippet2"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/VB/cursorstuff.vb" id="Snippet2"::: + ]]> diff --git a/xml/System.Windows.Forms/DataGridViewCell.xml b/xml/System.Windows.Forms/DataGridViewCell.xml index b30134becc6..6e6efc8c5ec 100644 --- a/xml/System.Windows.Forms/DataGridViewCell.xml +++ b/xml/System.Windows.Forms/DataGridViewCell.xml @@ -1264,9 +1264,9 @@ Starting with the .NET Framework 4.5.2, resizing of the error icon is determined by the system DPI setting when the app.config file contains the following entry: -``` +```xml + ``` diff --git a/xml/System.Windows.Forms/DataGridViewComboBoxColumn.xml b/xml/System.Windows.Forms/DataGridViewComboBoxColumn.xml index a302feba538..6dc09a921d6 100644 --- a/xml/System.Windows.Forms/DataGridViewComboBoxColumn.xml +++ b/xml/System.Windows.Forms/DataGridViewComboBoxColumn.xml @@ -49,34 +49,34 @@ Represents a column of objects. - class is a specialized type of used to logically host cells that enable users to select values from a list of choices. A has an associated in every that intersects it. - - You can populate the cells manually by setting their properties. Alternatively, you can bind the column to the data source indicated by the property. If the is bound to a database table, set the column property to the name of a column in the table. If the is bound to a collection of objects, set the property to the name of an object property. - - You can populate the column drop-down list manually by adding values to the collection. Alternatively, you can bind the drop-down list to its own data source by setting the column property. If the values are objects in a collection or records in a database table, you must also set the and properties. The property indicates which object property or database column provides the values that are displayed in the drop-down list. The property indicates which object property or database column is used to set the cell property. - - One typical scenario is to bind the control to a parent database table and bind the drop-down list to a related child table. For example, you might bind the control to an `Orders` table that contains a `ProductID` column and set the column property to a `Products` table that contains `ProductID` and `ProductName` columns. In this case, you would set the column property to "ProductID" to populate its cell values from the `Orders.ProductID` column. However, to display the actual product names in the cells and the drop-down list, you would map these values to the `Products` table by setting the property to "ProductID" and the property to "ProductName". - - The drop-down list values (or the values indicated by the property) must include the actual cell values or the control will throw an exception. - - Setting the column , , and properties automatically sets the corresponding properties of all cells in the column including the . To override these property values for specific cells, set the column property first, and then set the cell properties. - - Unlike the control, the does not have and properties. Instead, selecting a value from a drop-down list sets the cell property. - - The default sort mode for this column type is . - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. - + class is a specialized type of used to logically host cells that enable users to select values from a list of choices. A has an associated in every that intersects it. + + You can populate the cells manually by setting their properties. Alternatively, you can bind the column to the data source indicated by the property. If the is bound to a database table, set the column property to the name of a column in the table. If the is bound to a collection of objects, set the property to the name of an object property. + + You can populate the column drop-down list manually by adding values to the collection. Alternatively, you can bind the drop-down list to its own data source by setting the column property. If the values are objects in a collection or records in a database table, you must also set the and properties. The property indicates which object property or database column provides the values that are displayed in the drop-down list. The property indicates which object property or database column is used to set the cell property. + + One typical scenario is to bind the control to a parent database table and bind the drop-down list to a related child table. For example, you might bind the control to an `Orders` table that contains a `ProductID` column and set the column property to a `Products` table that contains `ProductID` and `ProductName` columns. In this case, you would set the column property to "ProductID" to populate its cell values from the `Orders.ProductID` column. However, to display the actual product names in the cells and the drop-down list, you would map these values to the `Products` table by setting the property to "ProductID" and the property to "ProductName". + + The drop-down list values (or the values indicated by the property) must include the actual cell values or the control will throw an exception. + + Setting the column , , and properties automatically sets the corresponding properties of all cells in the column including the . To override these property values for specific cells, set the column property first, and then set the cell properties. + + Unlike the control, the does not have and properties. Instead, selecting a value from a drop-down list sets the cell property. + + The default sort mode for this column type is . + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet0"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet0"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet0"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet0"::: + ]]> @@ -119,11 +119,11 @@ Initializes a new instance of the class to the default state. - instance, this constructor sets the property to a new instance. - + instance, this constructor sets the property to a new instance. + ]]> @@ -180,11 +180,11 @@ if auto completion is activated; otherwise, . The default is . - property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. - + property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. + ]]> The value of the property is . @@ -239,23 +239,23 @@ Gets or sets the template used to create cells. A that all other cells in the column are modeled after. The default value is a new . - class initializes this property to a newly created . - + class initializes this property to a newly created . + > [!CAUTION] -> Changing the properties of the cell template will not immediately affect the user interface (UI) of the column's existing cells. These changes are only apparent after the column is regenerated (for example, by sorting the column or through a call to the method). - - - -## Examples - The following code example demonstrates the use of the property, which is similar to this property. This example is part of a larger example available in [How to: Manipulate Columns in the Windows Forms DataGridView Control](/dotnet/framework/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control). - +> Changing the properties of the cell template will not immediately affect the user interface (UI) of the column's existing cells. These changes are only apparent after the column is regenerated (for example, by sorting the column or through a call to the method). + + + +## Examples + The following code example demonstrates the use of the property, which is similar to this property. This example is part of a larger example available in [How to: Manipulate Columns in the Windows Forms DataGridView Control](/dotnet/framework/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control). + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp" id="Snippet120"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/AutoResizeColumn/DataGridViewColumnDemo.cs" id="Snippet120"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/VB/datagridviewcolumndemo.vb" id="Snippet120"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/VB/datagridviewcolumndemo.vb" id="Snippet120"::: + ]]> When setting this property to a value that is not of type . @@ -293,11 +293,11 @@ Creates an exact copy of this column. An that represents the cloned . - @@ -363,24 +363,24 @@ Gets or sets the data source that populates the selections for the combo boxes. An object that represents a data source. The default is . - or properties specify where to retrieve the selection data shown in the combo box drop-down list. When using the property, if the data must be drawn from a nondefault property or column, then the property must be set to the name of the nondefault property or column. - - If the property is set to a string array, then and do not need to be set because each string in the array will be used for both value and display. - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. The property is used to populate the combo box with a selection of titles. This example is part of a larger example available in the class overview topic. - + or properties specify where to retrieve the selection data shown in the combo box drop-down list. When using the property, if the data must be drawn from a nondefault property or column, then the property must be set to the name of the nondefault property or column. + + If the property is set to a string array, then and do not need to be set because each string in the array will be used for both value and display. + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. The property is used to populate the combo box with a selection of titles. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet40"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet40"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: + ]]> The value of the property is . @@ -457,26 +457,26 @@ Gets or sets a string that specifies the property or column from which to retrieve strings for display in the combo boxes. A that specifies the name of a property or column in the data source specified in the property. The default is . - objects is obtained from the . If this data comes from a nondefault property or column, then the property must be set to the necessary property name or column name. - - If the cell values are internal values not visible to the user, then use and to map the internal cell values to user-viewable values. - - When the property is set to a string array, the property does not need to be set because each string in the array will be used as a valid display string and as a valid underlying value. - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in data entry of the title column. is set to the property name responsible for containing the user-viewable text. In this example, the is set to the same value as because no mapping is necessary. This example is part of a larger example available in the class overview topic. - + objects is obtained from the . If this data comes from a nondefault property or column, then the property must be set to the necessary property name or column name. + + If the cell values are internal values not visible to the user, then use and to map the internal cell values to user-viewable values. + + When the property is set to a string array, the property does not need to be set because each string in the array will be used as a valid display string and as a valid underlying value. + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in data entry of the title column. is set to the property name responsible for containing the user-viewable text. In this example, the is set to the same value as because no mapping is necessary. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet40"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet40"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: + ]]> The value of the property is . @@ -533,19 +533,19 @@ Gets or sets a value that determines how the combo box is displayed when not editing. A value indicating the combo box appearance. The default is . - property affects the appearance of cells in the column when they are not in edit mode, and regardless of whether they are read-only. When a cell is in edit mode, it always looks like a control. - - If the property value is `false`, the property affects all cells in the column; otherwise, the property affects only the current cell. - - The behavior and appearance of the drop-down arrow in the cells is indicated by the property. - - To enable cell highlighting when the mouse pointer is over a cell, you must set the property to and the property to . - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - + property affects the appearance of cells in the column when they are not in edit mode, and regardless of whether they are read-only. When a cell is in edit mode, it always looks like a control. + + If the property value is `false`, the property affects all cells in the column; otherwise, the property affects only the current cell. + + The behavior and appearance of the drop-down arrow in the cells is indicated by the property. + + To enable cell highlighting when the mouse pointer is over a cell, you must set the property to and the property to . + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + ]]> The value of the property is . @@ -602,15 +602,15 @@ if the display style applies only to the current cell; otherwise . The default is . - property value is `false`, the property affects all cells in the column; otherwise, the property affects only the current cell. - - The property affects the appearance of cells in the column when they are not in edit mode, and regardless of whether they are read-only. When a cell is in edit mode, it always looks like a control. - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - + property value is `false`, the property affects all cells in the column; otherwise, the property affects only the current cell. + + The property affects the appearance of cells in the column when they are not in edit mode, and regardless of whether they are read-only. When a cell is in edit mode, it always looks like a control. + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + ]]> The value of the property is . @@ -664,22 +664,22 @@ Gets or sets the width of the drop-down lists of the combo boxes. The width, in pixels, of the drop-down lists. The default is 1. - property of the member. - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. - + property of the member. + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet40"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet40"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: + ]]> The value of the property is . @@ -733,32 +733,32 @@ Gets or sets the flat style appearance of the column's cells. A value indicating the cell appearance. The default is . - property affects the behavior and appearance of the drop-down arrows for the cells in this column. - - Starting with the .NET Framework 4.6, when the property is set to `Flat` or `Popup` the drop-down arrows are resized according to the system DPI settings when the app.config file contains the following entry: - -``` - - -``` - - To enable cell highlighting when the mouse pointer is over a cell, you must set the property to and the property to . - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. - + property affects the behavior and appearance of the drop-down arrows for the cells in this column. + + Starting with the .NET Framework 4.6, when the property is set to `Flat` or `Popup` the drop-down arrows are resized according to the system DPI settings when the app.config file contains the following entry: + +```xml + + + +``` + + To enable cell highlighting when the mouse pointer is over a cell, you must set the property to and the property to . + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet40"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet40"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: + ]]> The value of the property is . @@ -813,29 +813,29 @@ Gets the collection of objects used as selections in the combo boxes. An that represents the selections in the combo boxes. - property of the returned by the property. - - The or properties are used to populate the selections of the combo boxes. - - If strings are added to , then the and properties do not need to be set because each string added will be used for both value and display. - + property of the returned by the property. + + The or properties are used to populate the selections of the combo boxes. + + If strings are added to , then the and properties do not need to be set because each string added will be used for both value and display. + > [!NOTE] -> does not support the use of multiple items with identical display values. - - If the property is set, then cannot be used. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. The property is used to populate the combo box drop-down list with a selection of titles. This example is part of a larger example available in the class overview topic. - +> does not support the use of multiple items with identical display values. + + If the property is set, then cannot be used. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. The property is used to populate the combo box drop-down list with a selection of titles. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet30"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet30"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: + ]]> The value of the property is . @@ -893,20 +893,20 @@ Gets or sets the maximum number of items in the drop-down list of the cells in the column. The maximum number of drop-down list items, from 1 to 100. The default is 8. - property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. - + property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet30"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet30"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: + ]]> The value of the property is . @@ -961,20 +961,20 @@ if the combo box is sorted; otherwise, . The default is . - property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. - + property of the object returned by the property. Setting this property also sets the property of every cell in the column. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet30"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet30"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet30"::: + ]]> The value of the property is . @@ -1078,24 +1078,24 @@ Gets or sets a string that specifies the property or column from which to get values that correspond to the selections in the drop-down list. A that specifies the name of a property or column used in the property. The default is . - for more information about its relationship with . - - When the property is set to a string array, the property does not need to be set because each string in the array will be used as a valid display string and as a valid underlying value. - - Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. - - - -## Examples - The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. - + for more information about its relationship with . + + When the property is set to a string array, the property does not need to be set because each string in the array will be used as a valid display string and as a valid underlying value. + + Getting or setting this property gets or sets the property of the object returned by the property. Setting this property also sets the property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value. + + + +## Examples + The following code example demonstrates how to use a to aid in entering data into the `TitleOfCourtesy` column. This example is part of a larger example available in the class overview topic. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet40"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet40"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet40"::: + ]]> The value of the property is . diff --git a/xml/System.Windows.Forms/DataGridViewRow.xml b/xml/System.Windows.Forms/DataGridViewRow.xml index 270c97ccf15..11700fcbd56 100644 --- a/xml/System.Windows.Forms/DataGridViewRow.xml +++ b/xml/System.Windows.Forms/DataGridViewRow.xml @@ -947,17 +947,14 @@ Starting with the .NET Framework 4.5.2, the error icon is resized according to the system DPI setting when the app.config file contains the following entry: -``` +```xml - ``` If this row is associated with a control, setting this property will raise the event. - - ## Examples The following code example demonstrates how to use the property in a event handler. This example is part of a larger example available in the class overview. diff --git a/xml/System.Windows.Forms/DomainUpDown.xml b/xml/System.Windows.Forms/DomainUpDown.xml index e20fd9cfa58..578656fa4ef 100644 --- a/xml/System.Windows.Forms/DomainUpDown.xml +++ b/xml/System.Windows.Forms/DomainUpDown.xml @@ -50,33 +50,30 @@ Represents a Windows spin box (also known as an up-down control) that displays string values. - control displays a single string value that is selected from an collection by clicking the up or down buttons of the control. The user can also enter text in the control, unless the property is set to `true` (the string typed in must match an item in the collection to be accepted). When an item is selected, the object is converted to a string value so it can be displayed in the spin box. - - To create a collection of objects to display in the control, you can add or remove the items individually by using the and methods. This can be called in an event handler, such as the event of a button. The object collection can be sorted alphabetically by setting the property to `true`. When the property is set to `true`, if you scroll past the last or first object in the collection, the list will start over with the first or last object respectively and appear to roll in a continuous list. - - When the or methods are called, either in code or by the click of the up or down buttons, is called to update the control with the new string. If is set to `true`, the string is matched to one of the values in the collection prior to updating the control's text display. - - Starting with the .NET Framework 4.6, the control will be resized based on the system DPI setting when the app.config file contains the following entry: - -``` - - - -``` - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + control displays a single string value that is selected from an collection by clicking the up or down buttons of the control. The user can also enter text in the control, unless the property is set to `true` (the string typed in must match an item in the collection to be accepted). When an item is selected, the object is converted to a string value so it can be displayed in the spin box. + + To create a collection of objects to display in the control, you can add or remove the items individually by using the and methods. This can be called in an event handler, such as the event of a button. The object collection can be sorted alphabetically by setting the property to `true`. When the property is set to `true`, if you scroll past the last or first object in the collection, the list will start over with the first or last object respectively and appear to roll in a continuous list. + + When the or methods are called, either in code or by the click of the up or down buttons, is called to update the control with the new string. If is set to `true`, the string is matched to one of the values in the collection prior to updating the control's text display. + + Starting with the .NET Framework 4.6, the control will be resized based on the system DPI setting when the app.config file contains the following entry: + +```xml + + + +``` + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -106,15 +103,15 @@ Initializes a new instance of the class. - control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -145,14 +142,14 @@ Creates a new accessibility object for the control. A new for the control. - method, it will be called when the property is referenced. - + method, it will be called when the property is referenced. + > [!NOTE] -> To get or set the property, you must add a reference to the Accessibility assembly installed with the .NET Framework. - +> To get or set the property, you must add a reference to the Accessibility assembly installed with the .NET Framework. + ]]> @@ -187,11 +184,11 @@ Displays the next item in the object collection. - control using the down button, you will eventually reach the last item in the collection. If you continue, and is set to `true`, the list will start over with the first item in the collection and appear to be continuous. This behavior also occurs when you move through the collection using the up button. - + control using the down button, you will eventually reach the last item in the collection. If you continue, and is set to `true`, the list will start over with the first item in the collection and appear to be continuous. This behavior also occurs when you move through the collection using the up button. + ]]> @@ -254,20 +251,20 @@ A collection of objects assigned to the spin box (also known as an up-down control). A that contains an collection. - collection can be built and made available to the control in two ways. You can add items to the collection by using the or methods. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + collection can be built and made available to the control in two ways. You can add items to the collection by using the or methods. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -362,22 +359,22 @@ An that contains the event data. Raises the event. - method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -452,15 +449,15 @@ A that contains the event data. Raises the event. - property is set to `true`, the control chooses the item on the list that begins with the character. If more than one item in the collection starts with the same character, the control selects the next item that begins with the typed character, starting from the currently selected position. - - Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/). - - The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. - + property is set to `true`, the control chooses the item on the list that begins with the character. If more than one item in the collection starts with the same character, the control selects the next item that begins with the typed character, starting from the currently selected position. + + Raising an event invokes the event handler through a delegate. For more information, see [Handling and Raising Events](/dotnet/standard/events/). + + The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class. + ]]> @@ -513,11 +510,11 @@ in all cases. - property, it will have a value of . - + property, it will have a value of . + ]]> @@ -558,11 +555,11 @@ Occurs when the value of the property changes. - @@ -604,29 +601,29 @@ Gets or sets the index value of the selected item. The zero-based index value of the selected item. The default value is -1. - property holds the index value of the item in the collection that is currently selected in the spin box (also known as an up-down control). Collection items can be reassigned new index values if the property has been changed from `false` to `true`. As the collection is re-sorted alphabetically, the items will be assigned a new index value. - + property holds the index value of the item in the collection that is currently selected in the spin box (also known as an up-down control). Collection items can be reassigned new index values if the property has been changed from `false` to `true`. As the collection is re-sorted alphabetically, the items will be assigned a new index value. + > [!NOTE] -> If the user has entered an item in the spin box, or if no item has been selected, the value will be the default value, -1. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - +> If the user has entered an item in the spin box, or if no item has been selected, the value will be the default value, -1. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box. The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> - The assigned value is less than the default, -1. - - -or- - + The assigned value is less than the default, -1. + + -or- + The assigned value is greater than the count. @@ -673,20 +670,20 @@ Gets or sets the selected item based on the index value of the selected item in the collection. The selected item based on the value. The default value is . - property is set to the appropriate index value. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + property is set to the appropriate index value. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -719,21 +716,21 @@ Occurs when the property has been changed. - event to occur, the property can be changed in code, by the user typing in a new value or clicking the control's up or down buttons. - - - -## Examples - The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing with or appending the message to a multiline . - - To run the example code, paste it into a project that contains an instance of type named `DomainUpDown1`. Then ensure that the event handler is associated with the event. - + event to occur, the property can be changed in code, by the user typing in a new value or clicking the control's up or down buttons. + + + +## Examples + The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing with or appending the message to a multiline . + + To run the example code, paste it into a project that contains an instance of type named `DomainUpDown1`. Then ensure that the event handler is associated with the event. + :::code language="csharp" source="~/snippets/csharp/System.ComponentModel/CollectionChangeEventArgs/Overview/EventExamples.cs" id="Snippet381"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb" id="Snippet381"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb" id="Snippet381"::: + ]]> @@ -779,20 +776,20 @@ if the item collection is sorted; otherwise, . The default value is . - is set to `true`, the collection is sorted in alphabetical order. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + is set to `true`, the collection is sorted in alphabetical order. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> @@ -825,11 +822,11 @@ Returns a string that represents the control. A string that represents the current . - and properties. - + and properties. + ]]> @@ -861,11 +858,11 @@ Displays the previous item in the collection. - control using the up button, you will eventually reach the first item in the collection. If you continue, and is set to `true`, the list will start over with the last item in the collection and appear to be continuous. This behavior also occurs when you move through the collection using the down button. - + control using the up button, you will eventually reach the first item in the collection. If you continue, and is set to `true`, the list will start over with the last item in the collection and appear to be continuous. This behavior also occurs when you move through the collection using the down button. + ]]> @@ -947,20 +944,20 @@ if the list starts again when the user reaches the beginning or end of the collection; otherwise, . The default value is . - property is set to `true`, if you reach the last item in the collection and continue, the list will start over with the first item and appear to be continuous. This behavior works in reverse as well. - - - -## Examples - The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. - + property is set to `true`, if you reach the last item in the collection and continue, the list will start over with the first item and appear to be continuous. This behavior works in reverse as well. + + + +## Examples + The following code example creates and initializes a control. The example allows you to set some of its properties and create a collection of strings for display in the spin box (also known as an up-down control). The code assumes that a , , and have been instantiated on a form. The example also assumes that you have a member variable at the class level declared as a 32-bit signed integer named `myCounter`. You can enter a string in the text box and add it to the collection when the button is clicked. By clicking the check box, you can toggle the property and observe the difference in the collection of items in the spin box. + :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DomainUpDown/Overview/source.cs" id="Snippet1"::: - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: - + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic DomainUpDown Example/VB/source.vb" id="Snippet1"::: + ]]> diff --git a/xml/System.Windows.Forms/ToolStripMenuItem.xml b/xml/System.Windows.Forms/ToolStripMenuItem.xml index 313b544c774..9b4469752ee 100644 --- a/xml/System.Windows.Forms/ToolStripMenuItem.xml +++ b/xml/System.Windows.Forms/ToolStripMenuItem.xml @@ -453,7 +453,7 @@ Starting with the .NET Framework 4.5.2, when an item is checked or indeterminate, the corresponding icon may be resized. Resizing is determined by the system DPI setting when the app.config file contains the following entry: -``` +```xml   @@ -614,7 +614,7 @@ Starting with the .NET Framework 4.5.2, if the property is set to or , the corresponding icon may be resized. Resizing is determined by the system DPI setting when the app.config file contains the following entry: -``` +```xml   diff --git a/xml/System.Windows.Forms/TreeView.xml b/xml/System.Windows.Forms/TreeView.xml index a1f0ef84ec3..8c1e20e05b5 100644 --- a/xml/System.Windows.Forms/TreeView.xml +++ b/xml/System.Windows.Forms/TreeView.xml @@ -81,7 +81,6 @@ - ``` Tree nodes can be expanded to display the next level of child tree nodes. The user can expand the by clicking the plus-sign (+) button, if one is displayed next to the , or you can expand the by calling the method. To expand all the child tree node levels in the collection, call the method. You can collapse the child level by calling the method, or the user can press the minus-sign (-) button, if one is displayed next to the . You can also call the method to alternate between the expanded and collapsed states. @@ -4804,11 +4803,10 @@ If you set the property The state images displayed in the are 16 x 16 pixels by default. Setting the property of the will have no effect on how the images are displayed. However, the state images are resized according to the system DPI setting when the app.config file contains the following entry: -``` +```xml - ``` When the property of a is set to `true` and the property is set, each that is contained in the displays the first and second images from the to indicate an unchecked or checked state, respectively. You should set the property before you add nodes to the to prevent state images being shown at design time for nodes that do not have a state image set.