DataGridViewColumnHeaderCell.GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String) 方法

定义

检索要复制到 Clipboard 的单元格的已设置格式的值。Retrieves the formatted value of the cell to copy to the Clipboard.

protected:
 override System::Object ^ GetClipboardContent(int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, System::String ^ format);
protected override object GetClipboardContent (int rowIndex, bool firstCell, bool lastCell, bool inFirstRow, bool inLastRow, string format);
override this.GetClipboardContent : int * bool * bool * bool * bool * string -> obj
Protected Overrides Function GetClipboardContent (rowIndex As Integer, firstCell As Boolean, lastCell As Boolean, inFirstRow As Boolean, inLastRow As Boolean, format As String) As Object

参数

rowIndex
Int32

包含该单元格的行从零开始的索引。The zero-based index of the row containing the cell.

firstCell
Boolean

若单元格位于由选定单元格定义的区域的第一列,则为 true;否则为 falsetrue to indicate that the cell is in the first column of the region defined by the selected cells; otherwise, false.

lastCell
Boolean

若单元格位于由选定单元格定义的区域的最后一列,则为 true;否则为 falsetrue to indicate that the cell is the last column of the region defined by the selected cells; otherwise, false.

inFirstRow
Boolean

若单元格位于由选定单元格定义的区域的第一行,则为 true;否则为 falsetrue to indicate that the cell is in the first row of the region defined by the selected cells; otherwise, false.

inLastRow
Boolean

如果该单元格位于选定单元格所定义区域内的最后一行中,则为 true;否则为 falsetrue to indicate that the cell is in the last row of the region defined by the selected cells; otherwise, false.

format
String

单元格的当前格式字符串。The current format string of the cell.

返回

Object

Object,它表示要复制到 Clipboard 的单元格的值。A Object that represents the value of the cell to copy to the Clipboard.

例外

rowIndex 不是 -1。rowIndex is not -1.

注解

根据控件的属性的值 ClipboardCopyMode DataGridView ,此方法由控件的方法调用, GetClipboardContent 用于检索表示单元格的剪贴板格式值。Depending on the value of the ClipboardCopyMode property of the DataGridView control, this method is called by the control's GetClipboardContent method to retrieve a clipboard-formatted value that represents the cell.

此方法的位置相关参数指示此单元格位于数据表中的位置,该数据表示控件中的选定单元格定义的区域 DataGridViewThe position-related parameters of this method indicate where this cell is located in the table of data representing the region defined by the selected cells in the DataGridView control. 除了单元格值外,此方法还可能会返回格式设置信息,具体取决于单元格的位置。Depending on the cell's position, formatting information may be returned by this method in addition to the cell value. 例如,行第一列中的单元格的 HTML 格式将包括指示行的开头的标记。For example, the HTML format for a cell in the first column of a row will include the tag that indicates the beginning of a row.

支持的剪贴板格式包括 DataFormats.TextDataFormats.UnicodeTextDataFormats.HtmlDataFormats.CommaSeparatedValueThe supported clipboard formats include DataFormats.Text, DataFormats.UnicodeText, DataFormats.Html, and DataFormats.CommaSeparatedValue.

有关更多信息,请参见 Clipboard 类。For more information, see the Clipboard class.

适用于

另请参阅