Çalışma Sayfalarında Cell Kontrollerini Yönetme

Cell Kontrollerine Erişim

Çalışma sayfasındaki mevcut bir hücre kontrolüne erişmek ve değiştirmek için geliştiriciler, çalışma sayfasından belirli bir hücre kontrolüne erişebilir.Kontroller koleksiyonuÇalışma kağıdı hücre kontrolünün görüntülendiği hücreyi belirterek (hücre adını veya satır ve sütun numaraları cinsinden konumunu kullanarak). Bir hücre kontrolüne erişildiğinde, geliştiriciler çalışma zamanında özelliklerini değiştirebilir. Örneğin, aşağıda verilen örnekte, mevcut birOnay Kutusu hücre kontrolüÇalışma kağıdı ve Checked özelliğini değiştirdi.

ÖNEMLİ: Kontroller koleksiyon, biçimindeki her tür hücre denetimini içerir.Hücre Kontrolü nesneler. Bu nedenle, belirli bir hücre kontrolü türüne erişmeniz gerekirse, diyelim kiOnay Kutusu o zaman şunu yazmanız gerekecek:Hücre Kontrolü itiraz etmekOnay Kutusu sınıf.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Getting the location of the cell that is currently in focus
CellLocation cl = sheet.GetFocusedCellLocation();
// Accessing cell control and typecasting it to CheckBox
Aspose.Cells.GridDesktop.CheckBox cb = (Aspose.Cells.GridDesktop.CheckBox)sheet.Controls[cl.Row, cl.Column];
if (cb != null)
{
// Modifying the Checked property of CheckBox
cb.Checked = true;
}
else
{
MessageBox.Show("Please add control before accessing it.");
}

Cell Denetimlerini Kaldırma

Mevcut bir hücre denetimini kaldırmak için, geliştiriciler yalnızca istenen bir çalışma sayfasına erişebilir ve ardındanKaldırmak gelen hücre kontrolüKontroller koleksiyonuÇalışma kağıdı hücre kontrolünü içeren hücreyi (adını veya satır ve sütun numarasını kullanarak) belirterek.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Getting the location of the cell that is currently in focus
CellLocation cl = sheet.GetFocusedCellLocation();
// Removing the cell control by specifying the location of cell containing it
sheet.Controls.Remove(cl.Row, cl.Column);