visual basic.net的面板着色 [英] Panel coloring for visual basic.net

查看:97
本文介绍了visual basic.net的面板着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!



我正在vb.net中设计一个系统,我希望能够更有效地为我的系统中的表单上的面板着色。所以目前我有这段代码来获得精确的十六进制颜色:



Panel1.BackColor = ColorTranslator.FromHtml(#0c7ac0)'提供蓝色面板



无论如何我可以创建一个函数或子函数,我只需要调用而不是为每个表单重写这个函数



非常感谢任何帮助:)!



我尝试过:



我试过制作一个公共子,但它只适用于那种形式

解决方案

你可以继承Panel类,给它你想要的颜色。然后在所有表单中使用此自定义面板子类。

 公共  CustomPanel 继承面板

公共 < span class =code-keyword> Sub New ()
Me .BackColor = ColorTranslator.FromHtml( #0c7ac0
结束 Sub

结束


Hi !

I am designing a system in vb.net and I would like to make a more efficient way of coloring a panel that I have on my forms in my system. so currently I have this piece of code to get an exact hex color :

Panel1.BackColor = ColorTranslator.FromHtml("#0c7ac0") 'Providing Blue Panel

Is there anyway that I can create a function or sub whereby I just need to call to instead of rewritting this for every form

really appreciate any help :) !

What I have tried:

I tried making a public sub but it only works for that form

解决方案

You can subclass the Panel class, giving it the color you want. then use this custom panel subclass in all your forms.

Public Class CustomPanel Inherits Panel

   Public Sub New()
      Me.BackColor = ColorTranslator.FromHtml("#0c7ac0")
   End Sub

End Class


这篇关于visual basic.net的面板着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆