我希望Chnage All Form按钮lebal groupbox从一个地方返回颜色 [英] I want Chnage All Form button lebal groupbox back color from one place
本文介绍了我希望Chnage All Form按钮lebal groupbox从一个地方返回颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望更改所有表格,按钮,lebal背景形式一个地方或一个功能
如果我在一个地方改变颜色然后改变颜色从
i want change all form ,button ,lebal background form one place or in one function
if i change color in one place then change color from all from
推荐答案
我找到了这些解决方案
首先在项目中添加一个模块并添加代码
模块模块1
Public Sub ResetAllControlsBackColor(ByVal控件作为控件)
如果TypeOf控件是Form然后
control.BackColor = Color.FromArgb(255,192,192)
结束如果
如果TypeOf控件是按钮那么
control.BackColor = Color.DeepSkyBlue
control.ForeColor = Color.Black
结束如果
如果TypeOf控件是标签那么
control.BackColor = Color.Transparent
结束如果
如果TypeOf控件是GroupBox那么
control.BackCo lor = Color.FromArgb(224,224,224)
结束如果
如果control.HasChildren那么
Dim childControl As Control
For each childControl in control.Controls
ResetAllControlsBackColor(childControl)
下一个childControl
结束如果
结束次级
结束模块
之后在每个表单加载后添加
ResetAllControlsBackColor(Me)
I Found Solution for these
First add one module to your project and add code
Module Module1
Public Sub ResetAllControlsBackColor(ByVal control As Control)
If TypeOf control Is Form Then
control.BackColor = Color.FromArgb(255, 192, 192)
End If
If TypeOf control Is Button Then
control.BackColor = Color.DeepSkyBlue
control.ForeColor = Color.Black
End If
If TypeOf control Is Label Then
control.BackColor = Color.Transparent
End If
If TypeOf control Is GroupBox Then
control.BackColor = Color.FromArgb(224, 224, 224)
End If
If control.HasChildren Then
Dim childControl As Control
For Each childControl In control.Controls
ResetAllControlsBackColor(childControl)
Next childControl
End If
End Sub
End Module
After that in each form load add
ResetAllControlsBackColor(Me)
这篇关于我希望Chnage All Form按钮lebal groupbox从一个地方返回颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文