Properties Merged from OLEObject or OLEControl
After the control has been added to the document or spreadsheet, the experience of using the control on the design surface should be very close to that of working with a standard Windows Form. However, there are some differences. The biggest difference appears when you click a Windows Forms control in the document and use the categorized view in the Properties window. If you compare a Windows.Forms.Controls.Button with a Microsoft.Office.Tools.Excel.Controls.Button, you will see the extra properties merged in from the OLEObject. These properties are listed in the Misc category to denote that these properties are coming from OLEObject.
Excel Control Properties That Are Added from OLEObject
The OLEObject merge done for controls in the Microsoft.Office.Tools.Excel.Controls namespace adds several properties to VSTO extended controls that are not in the base Windows.Forms controls. Table 14-1 shows the most important properties that are added for controls in Excel.
Name | Type | Access | Description |
---|---|---|---|
BottomRightCell | Excel.Range | Read-only | The Range object that represents the cell that lies under the lower-right corner of the control. |
Enabled | bool | Read-write | Determines whether the control is enabled. If you set this to false, the control will show grayed-out in Excel. This enables you to control whether the control will accept input at runtime. |
Height | double | Read-write | The height, in points, of the control. |
Left | double | Read-write | The distance, in points, from the left edge of the control to the left edge of column A. |
Placement | object | Read-write | Determines how the control will be placed. This can be one of three values: xlFreeFloating (equivalent to Do not move or size with cell setting in the placement dialog) xlMove (equivalent to Move but do not size with cell setting in the placement dialog) xlMoveAndSize (equivalent to Move and size with cell setting in the placement dialog) |
PrintObject | bool | Read-write | Determines whether the control will print when the worksheet is printed. This can prove very useful if the control you are using is something like a button that should not be part of the final printed document. |
Shadow | bool | Read-write | Determines whether Excel should provide a drop shadow for the control. When set to true, Excel will provide a simple black drop shadow around the control |
TopLeftCell | Excel.Range | Read-only | The Range object that represents the cell that lies under the upper-left corner of the control. |
Top | double | Read-write | The distance, in points, from the top edge of the control to the top edge of row 1. |
Visible | bool | Read-write | Determines whether to hide the control at runtime. |
Width | double | Read-write | The width, in points, of the control. |
Word Control Properties Added from OLEControl
The OLEControl merge done for controls in the Microsoft.Office.Tools.Word.Controls namespace adds several properties to VSTO extended controls that are not in the base Windows.Forms controls.