Aracılığıyla paylaş


Button.TopLeftCell Özellik

Alır bir Range altında sol üst köşesinde bulunan hücre temsil eden nesne Button.

Ad alanı:  Microsoft.Office.Tools.Excel.Controls
Derleme:  Microsoft.Office.Tools.Excel.v4.0.Utilities (Microsoft.Office.Tools.Excel.v4.0.Utilities.dll içinde)

Sözdizimi

'Bildirim
Public ReadOnly Property TopLeftCell As Range
    Get
public Range TopLeftCell { get; }

Özellik Değeri

Tür: Microsoft.Office.Interop.Excel.Range
A Range altında sol üst köşesinde bulunan hücre temsil eden nesne Button.

Örnekler

Aşağıdaki kod örneği TopLeftCell ve BottomRightCell sol üst ve alt özellikler sağ hücreleri bağlantılı bir Button Denetim. Click Olay işleyicisi düğmesinin renklerini üst sol ve alt sağ hücreye red. kenarlıkları

Bu örnek, bir belge düzeyinde özelleştirme için bulunur.

Private Sub MarkCornerCells()
    Dim CornerButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(65, 45, 100, 25, "CornerButton")
    CornerButton.Text = "Click to highlight corners."
    AddHandler CornerButton.Click, AddressOf CornerButton_Click
End Sub

Private Sub CornerButton_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim ClickedButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        CType(sender, Microsoft.Office.Tools.Excel.Controls.Button)
    ClickedButton.BottomRightCell.Borders.Color = _
        ColorTranslator.ToOle(Color.Red)
    ClickedButton.TopLeftCell.Borders.Color = _
        ColorTranslator.ToOle(Color.Red)
End Sub
private void MarkCornerCells()
{
    Microsoft.Office.Tools.Excel.Controls.Button button1 =
        this.Controls.AddButton(65, 45, 100, 25,
        "button1");
    button1.Text = "Click to highlight corners.";
    button1.Click += new EventHandler(button1_Click);
}

void button1_Click(object sender, EventArgs e)
{
    Microsoft.Office.Tools.Excel.Controls.Button clickedButton =
        (Microsoft.Office.Tools.Excel.Controls.Button)sender;

    clickedButton.BottomRightCell.Borders.Color = 
        ColorTranslator.ToOle(Color.Red);
    clickedButton.TopLeftCell.Borders.Color =
        ColorTranslator.ToOle(Color.Red);
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

Button Sınıf

Microsoft.Office.Tools.Excel.Controls Ad Alanı