如何在按钮中使用不透明度? [英] How to use opacity in button?

查看:87
本文介绍了如何在按钮中使用不透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我正在尝试更改vb.net中按钮的不透明度.....


但我找不到像不透明度之类的任何属性..如何更改不透明度

程序的任何人都可以告诉我....

Hello friends

i am trying to change opacity of button in vb.net.....


but i couldn''t find any properties like opacity.. how can i change opacity

of program can anyone tell me....

推荐答案

为按钮设置UseVisibleStyleBackColor = False
假设按钮名称为"changeBatchLocationBtn"

然后在表单的加载事件中,使用以下给定的代码设置不透明度.

For the button Set the UseVisibleStyleBackColor = False
Suppose the button name is "changeBatchLocationBtn"

Then in the load event of the form set the opacity using the below given code.

Color col = changeBatchLocationBtn.BackColor;
changeBatchLocationBtn.BackColor = Color.FromArgb(50, col.R, col.G, col.B);



--------------------------------
FromArgb方法的第一个参数决定不透明度.较低的值表示较低的不透明度,较高的值表示较高的不透明度.
--------------------------------

请参考链接以获取参考.

http://stackoverflow.com/questions/1751914/opacity-of-buttons-textboxes- vb-net [ ^ ]

-Bhushan Deshmukh
(注意:如果发现答案有用,请在右上角提供适当的投票.)



--------------------------------
The 1st parameter for the FromArgb method decides the opacity. Lower value gives low opacity and higher value gives high opacity.
--------------------------------

Refer link for reference.

http://stackoverflow.com/questions/1751914/opacity-of-buttons-textboxes-vb-net[^]

-- Bhushan Deshmukh
(Note : if you find the answer helpful plz provide appropriate vote on the top right corner.)


按钮不支持任何不透明度属性.

请参见此处 [
A button does not support any opacity property.

See here[^] for an alternative.


您不能使用此类选项(例如除非您使用WPF(部分原因是因为WInFOrms使用GDI +,否则部分不透明度/自定义形状/阴影)(创建非标准元素(非标准意味着非矩形和非窗口状)的能力非常差). ,您可以使用API​​函数进行检查,但绝对不能提供最佳解决方案.作为替代选择,尝试查找其他公司的控制权
You CANNOT use such options(like partial opacity/custom shape/shadowing) unless you are using WPF(simply because WInFOrms uses GDI+, that has very poor power in creating non-standart elements(non-standart mean non-rectangular and non-windows-like).If you like,you can check with API functions, but it definetly will not provide best solution.As an alternative try finding controls of other firms


这篇关于如何在按钮中使用不透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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