Share via


DataGridView.Width Property

Definition

Gets or sets the width of the DataGridView in points.

public:
 property double Width { double get(); void set(double value); };
public double Width { get; set; }
member this.Width : double with get, set
Public Property Width As Double

Property Value

The width of the DataGridView in points.

Examples

For a code example that demonstrates how to use this property, see Microsoft.Office.Tools.Excel.Controls.Button.Width. All controls in the Microsoft.Office.Tools.Excel.Controls namespace have a functionally equivalent Width property.

Remarks

Changes made to the Width and left property values cause the Right property value of the DataGridView to change.

The Microsoft.Office.Tools.Excel.Controls.DataGridView.Width property uses points, whereas System.Windows.Forms.Control.Width property uses pixels.

Setting the value to a negative number or a number higher than 12288 does not throw an exception but results in the control being set between 1 and 12288.

Applies to