本文為機器翻譯文章。如需檢視英文版,請選取 [原文] 核取方塊。您也可以將滑鼠指標移到文字上,即可在快顯視窗顯示英文原文。
譯文
原文

Button.OLEType 屬性

 

取得值,表示 OLE 物件類型。

命名空間:   Microsoft.Office.Tools.Excel.Controls
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (於 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public object OLEType { get; }

屬性值

Type: System.Object

xlOLEControl

The following code example creates a T:Microsoft.Office.Tools.Excel.Controls.Button control and assigns the button text to a string that describes the OLE object type of the button, as determined by the P:Microsoft.Office.Tools.Excel.Controls.Button.OLEType property value.

This example is for a document-level customization.

private void DisplayOLEType()
{
    Microsoft.Office.Tools.Excel.Controls.Button oleButton =
            this.Controls.AddButton(this.Range["B2", "C3"],
            "oleButton1");

    string controlType;
    switch ((int)oleButton.OLEType)
    {
        case (int)Excel.XlOLEType.xlOLEControl:
            controlType = "OLE control";
            break;

        case (int)Excel.XlOLEType.xlOLEEmbed:
            controlType = "OLE embedded control";
            break;

        case (int)Excel.XlOLEType.xlOLELink:
            controlType = "OLE linked control";
            break;

        default:
            controlType = "Not assigned an OLE type";
            break;
    }
    oleButton.Text = controlType;
}
回到頁首
顯示: