Export (0) Print
Expand All

DataGridViewColumn.FillWeight Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets a value that represents the width of the column when it is in fill mode relative to the widths of other fill-mode columns in the control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public float FillWeight { get; set; }
/** @property */
public float get_FillWeight ()

/** @property */
public void set_FillWeight (float value)

public function get FillWeight () : float

public function set FillWeight (value : float)

Property Value

A Single representing the width of the column when it is in fill mode relative to the widths of other fill-mode columns. The default is 100.

Exception typeCondition

ArgumentOutOfRangeException

The specified value when setting this property is less than or equal to 0.

When the InheritedAutoSizeMode property value is Fill, the column is resized along with other columns in that mode so that all visible columns in the control exactly fill the horizontal width of the available display area. All fill-mode columns in the control divide the available space in proportions determined by their FillWeight property values. For more information about column fill mode, see Column Fill Mode in the Windows Forms DataGridView Control.

The maximum sum of FillWeight values for all columns in a DataGridView control is 65535.

The following code example illustrates the use of this property. This example is part of a larger example available in How to: Set the Sizing Modes of the Windows Forms DataGridView Control.

DataGridViewTextBoxColumn subTitleColumn = new DataGridViewTextBoxColumn();
subTitleColumn.HeaderText = "Subtitle";
subTitleColumn.MinimumWidth = 50;
subTitleColumn.FillWeight = 100;

DataGridViewTextBoxColumn summaryColumn = new DataGridViewTextBoxColumn();
summaryColumn.HeaderText = "Summary";
summaryColumn.MinimumWidth = 50;
summaryColumn.FillWeight = 200;

DataGridViewTextBoxColumn contentColumn = new DataGridViewTextBoxColumn();
contentColumn.HeaderText = "Content";
contentColumn.MinimumWidth = 50;
contentColumn.FillWeight = 300;

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft