问题描述:添加C1Themes到WinForms应用程序
问题解答:本文介绍如何添加C1Themes到已经存在的WinForms应用程序。C1Themes内置超过25种专业设计的主题,也可以自定义主题,用于应用程序。本文主要介绍了给C1FlexGrid和C1TrueDBGrid设置主题,根据下述步骤,也可以给ComponentOne Studio for WinForms的C1Report,C1Ribbon以及其他控件,添加C1Themes。
关键代码:
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- // Set theme on the theme controller:
- this.c1ThemeController1.Theme = this.comboBox1.SelectedItem.ToString();
- // ...and apply it to all themable controls (this will override any control-specific theme settings):
- Action setTheme = null;
- setTheme = (c) =>
- {
- if (C1.Win.C1Themes.C1ThemeController.IsObjectThemeable(c))
- this.c1ThemeController1.SetTheme(c, this.c1ThemeController1.Theme);
- foreach (Control cc in c.Controls)
- setTheme(cc);
- };
- setTheme(this);
- }
- }
复制代码
效果截图:
源码下载:
添加C1Themes到WinForms应用程序示例 |