إدارة Cell عناصر التحكم في الأعمدة
الوصول إلى Cell الضوابط
للوصول إلى عنصر تحكم خلية موجود وتعديله في العمود ، يمكن للمطورين استخدام الخاصية CellControl في ملفAspose.Cells.GridDesktop.Data.GridColumn . بمجرد الوصول إلى عنصر تحكم الخلية ، يمكن للمطورين تعديل خصائصه في وقت التشغيل. على سبيل المثال ، في المثال الموضح أدناه ، وصلنا إلى ملفخانة الاختيار التحكم في الخلية من ملفAspose.Cells.GridDesktop.Data.GridColumn وتعديل خاصية التحقق الخاصة به.
الأهمية: توفر خاصية CellControl عنصر تحكم خلية في شكلCellControlموضوع. لذلك ، إذا كنت بحاجة إلى الوصول إلى نوع معين من التحكم في الخلية ، على سبيل المثالخانة الاختيار ثم سوف تضطر إلى تلبيس ملفCellControl يعترض علىخانة الاختيار صف دراسي.
// 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."); | |
} |
إزالة Cell الضوابط
لإزالة عنصر تحكم خلية موجود ، يمكن للمطورين ببساطة الوصول إلى ورقة العمل المطلوبة وبعد ذلكيزيل عنصر تحكم الخلية من عمود معين باستخدامRemoveCellControl طريقةAspose.Cells.GridDesktop.Data.GridColumn.
// 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(); |