# 调整 Windows 窗体 DataGridView 控件中的列和行的大小Resizing Columns and Rows in the Windows Forms DataGridView Control

DataGridView 控件提供了很多用于自定义其列和行的大小调整行为的选项。The DataGridView control provides numerous options for customizing the sizing behavior of its columns and rows. 通常，DataGridView 单元不会根据其内容进行调整。Typically, DataGridView cells do not resize based on their contents. 相反，它们会剪裁大于该单元的任何显示值。Instead, they clip any display value that is larger than the cell. 如果内容显示为字符串，则单元格会在工具提示中显示它。If the content can be displayed as a string, the cell displays it in a ToolTip.

DataGridView 控件提供属性、方法和事件，使您可以自定义或禁用所有这些用户定向的行为。The DataGridView control provides properties, methods, and events that enable you to customize or disable all of these user-directed behaviors. 此外，可以以编程方式调整行、列和标头的大小以适应其内容，也可以将其配置为在其内容更改时自动调整其大小。Additionally, you can programmatically resize rows, columns, and headers to fit their contents, or you can configure them to automatically resize themselves whenever their contents change. 您还可以将列配置为按您指定的比例将控件的可用宽度自动划分。You can also configure columns to automatically divide the available width of the control in proportions that you specify.

## 本节内容In This Section

Windows 窗体 DataGridView 控件中的重设大小选项Sizing Options in the Windows Forms DataGridView Control

Windows 窗体 DataGridView 控件中的列填充模式Column Fill Mode in the Windows Forms DataGridView Control

DataGridView