Bagikan melalui


Button.Placement Properti

Definisi

Mendapatkan atau mengatur objek yang menunjukkan cara Button melampirkan ke sel di bawahnya.

public:
 property System::Object ^ Placement { System::Object ^ get(); void set(System::Object ^ value); };
public object Placement { get; set; }
member this.Placement : obj with get, set
Public Property Placement As Object

Nilai Properti

Salah satu nilai berikut XlPlacement : xlFreeFloating. xlMove. xlMoveAndSize.

Contoh

Contoh kode berikut menambahkan dua Button kontrol yang memiliki perilaku run-time yang berbeda ke lembar kerja. Tombol pertama mencakup rentang sel B2 hingga C3. Saat pengguna mengubah ukuran kolom atau baris dalam rentang ini pada durasi, tombol pertama akan mengubah ukuran untuk menyesuaikan dengan perubahan. Tombol kedua mencakup rentang sel B5 hingga C6, dan Placement properti tombol ini diatur ke xlFreeFloating. Saat pengguna mengubah ukuran kolom atau baris dalam rentang ini pada durasi, tombol kedua tidak akan mengubah ukuran.

Contoh ini untuk kustomisasi tingkat dokumen.

private void ComparePlacementBehavior()
{
    Microsoft.Office.Tools.Excel.Controls.Button cellButton =
        this.Controls.AddButton(this.Range["B2", "C3"],
        "cellButton");
    cellButton.Text = "Resizes with cells";

    Microsoft.Office.Tools.Excel.Controls.Button fixedButton =
        this.Controls.AddButton(this.Range["B5", "C6"],
        "fixedButton");
    fixedButton.Text = "Does not resize";
    fixedButton.Placement = Excel.XlPlacement.xlFreeFloating;
}
Private Sub ComparePlacementBehavior()

    Dim CellButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "C3"), "CellButton")
    CellButton.Text = "Resizes with cells"

    Dim FixedButton As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B5", "C6"), "FixedButton")
    FixedButton.Text = "Does not resize"
    FixedButton.Placement = Excel.XlPlacement.xlFreeFloating
End Sub

Berlaku untuk