集合编辑器外观

编程入门 行业动态 更新时间:2024-10-11 19:22:10
本文介绍了集合编辑器外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

创建从 CollectionEditor 继承的类后,我可以更改其内部控件的外观,从而访问 关联的 CollectionForm 的 ControlsCollection ,例如

after creating a class inherited from CollectionEditor I was able to change the appearance of its internal controls accessing the ControlsCollection of the associated CollectionForm, e.g.

.Controls[0].Controls[1].Controls[0].BackColor = ... ;

推荐答案

如果您希望每个控件使用不同的背景色,那么您必须按照现在的方式进行操作.但是,如果所有控件的背景颜色都相同,则可以按以下方式递归进行操作.

If you want different background colors for each control, then you have to do the way you are doing it now. But if the background color is same for all controls, you can do it recursively as below. public void ApplyBackColor(Control oCurrentControl, Color backColor) { oCurrentControl.BackColor = backColor; foreach (Control control in oCurrentControl.Controls) { ApplyBackColor(control, backColor); } }

更多推荐

集合编辑器外观

本文发布于:2023-11-07 19:08:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567182.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编辑器   外观

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!