共用方式為


DataGridView Class

Definition

Represents a Windows Forms DataGridView that can be added to a Microsoft Office Excel worksheet.

public ref class DataGridView : System::Windows::Forms::DataGridView
[System.ComponentModel.DefaultEvent("CellContentClick")]
[System.ComponentModel.DefaultProperty("Text")]
[System.ComponentModel.ToolboxItem(false)]
public class DataGridView : System.Windows.Forms.DataGridView
[<System.ComponentModel.DefaultEvent("CellContentClick")>]
[<System.ComponentModel.DefaultProperty("Text")>]
[<System.ComponentModel.ToolboxItem(false)>]
type DataGridView = class
    inherit DataGridView
Public Class DataGridView
Inherits DataGridView
Inheritance
DataGridView
Attributes

Remarks

The Microsoft.Office.Tools.Excel.Controls.DataGridView is different from a System.Windows.Forms.DataGridView. The Microsoft.Office.Tools.Excel.Controls.DataGridView has additional members that enable it to be added to an Excel worksheet and that give it additional methods and properties.

Do not use the New constructor to create a new DataGridView. Use the AddDataGridView method to add a new DataGridView to a worksheet.

Properties

AltHTML
Application

Gets an Application object that represents the creator of the DataGridView.

Border

Gets a Border that represents the border of the DataGridView.

Bottom

Gets the distance, in points, between the bottom edge of the DataGridView and the top edge of the worksheet.

BottomRightCell

Gets a Range object that represents the cell that lies under the lower-right corner of the DataGridView.

Creator

Gets a value that indicates the application in which the DataGridView was created.

Height

Gets or sets the height of the DataGridView.

Index

Gets the index number of the DataGridView within the collection of OLEObjects on the sheet.

Interior

Gets an Interior object that represents the interior of the DataGridView.

Left

Gets or sets the distance, in points, between the left edge of the DataGridView and the left edge of the worksheet.

Locked

Gets or sets a value that indicates whether the DataGridView can be modified at design time when the sheet is protected.

OLEType

Gets a value that represents the OLE object type.

OnAction
Parent

Gets the parent object for the DataGridView.

Placement

Gets or sets an object that indicates the way the DataGridView is attached to the cells below it.

PrintObject

Gets or sets a value that indicates whether the DataGridView is printed when the worksheet is printed.

Right

Gets the distance, in points, between the right edge of the DataGridView and the left edge of the worksheet.

ShapeRange

Gets a ShapeRange object that represents the DataGridView.

SourceName

Gets or sets the link source name of the DataGridView.

Top

Gets or sets the distance, in points, between the top edge of the DataGridView and the top edge of the worksheet.

TopLeftCell

Gets a Range object that represents the cell that lies under the upper-left corner of the DataGridView.

Visible

Gets or sets a value that represents whether the DataGridView is visible.

Width

Gets or sets the width of the DataGridView in points.

ZOrder

Gets the z-order position of the DataGridView.

Methods

Activate()

Activates the DataGridView.

BringToFront()

Brings the DataGridView to the front of the z-order.

CopyPicture(XlPictureAppearance, XlCopyPictureFormat)

Copies the DataGridView to the Clipboard as a picture.

Delete()

Deletes a dynamically created DataGridView from the worksheet and removes it from the ControlCollection.

Select(Object)

Selects the DataGridView.

SendToBack()

Sends the DataGridView to the back of the z-order.

SetVisibleCore(Boolean)

Sets the DataGridView to the specified visible state.

Update()

Applies to