简体   繁体   中英

Opacity on Control

是否可以使控件半透明?

The direct answer to your question is 'No'.

WinForms supports Translucency at the Form level ( Form.Opacity ), but not controls. In cases this was important, I have used layered forms.

If this feature is important and changing frameworks is an option, WPF does support translucent controls.

If the control supports transparent backgrounds, you can use Color.FromArgb() to set a translucent color:

button1.BackColor = Color.FromArgb(100, Color.Red);

Depending on how you want this to work, you would vary the alpha value (to between 0 and 255).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM