Sütunlarda Hücre Kontrolleri Yönetimi
Hücre Kontrollerine Erişme
Varolan bir hücre kontrolüne sütundan erişip değiştirmek için geliştiriciler, bir Aspose.Cells.GridDesktop.Data.GridColumn özelliği olan CellControl‘ü kullanabilir. Bir kez bir hücre kontrolüne erişildiğinde, geliştiriciler çalışma zamanında özelliklerini değiştirebilirler. Örneğin, aşağıdaki örnekte belirli bir Aspose.Cells.GridDesktop.Data.GridColumn‘dan varolan bir CheckBox hücre kontrolüne eriştik ve Checked özelliğini değiştirdik.
ÖNEMLİ: CellControl özelliği, CellControl nesnesi formunda bir hücre kontrolü sağlar. Dolayısıyla, belirli bir türde hücre kontrolüne erişmeniz gerekiyorsa, örneğin CheckBox ise CellControl nesnesini CheckBox sınıfına dönüştürmeniz gerekir.
// 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(); | |
// Accessing cell control in the column and typecasting it to CheckBox | |
Aspose.Cells.GridDesktop.CheckBox cb = (Aspose.Cells.GridDesktop.CheckBox)sheet.Columns[2].CellControl; | |
if (cb != null) | |
{ | |
// Modifying the Checked property of CheckBox | |
cb.Checked = true; | |
} | |
else | |
{ | |
MessageBox.Show("Please add control before accessing it."); | |
} |
Hücre Kontrollerini Kaldırma
Varolan bir hücre kontrolünü kaldırmak isteyen geliştiriciler, istenen çalışma sayfasına erişip ardından Aspose.Cells.GridDesktop.Data.GridColumn‘ın RemoveCellControl yöntemini kullanarak belirli sütundan hücre kontrolünü kaldırabilirler.
// 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(); | |
// Removing cell control from the column | |
sheet.Columns[2].RemoveCellControl(); |