原因为什么一个WinForms标签不想是透明的? [英] Reasons for why a WinForms label does not want to be transparent?

查看:86
本文介绍了原因为什么一个WinForms标签不想是透明的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为什么不能设置标签的背景色为透明?我以前做过,但现在它只是不想...

Why can't I set the BackColor of a Label to Transparent? I have done it before, but now it just don't want to...

我创建了一个新的用户控件,增加了一个进度条和一个标签给它。当我设置标签的背景色透明是仍然灰色= /这是为什么?

I created a new UserControl, added a progressbar and a label to it. When I set the BackColor of the label to transparent it is still gray =/ Why is this?

我想要的是有对进度条上方的标签,这样它的文字是在的进度...

What I wanted was to have the label on top of the progressbar so that its text was "in" the progressbar...

推荐答案

的WinForms真的不支持透明控制,但你可以做一个透明的控制自己。 <一href=\"http://stackoverflow.com/questions/373913/setting-the-parent-of-a-usercontrol-$p$pvents-it-from-being-transparent/373961#373961\">See在这里我的答案的。

WinForms doesn't really support transparent controls, but you can make a transparent control yourself. See my answer here.

在你的情况,你可能应该子类进度栏和重写OnPaint方法来绘制进度条上的文本。

In your case you should probably subclass the progress bar and override the OnPaint method to draw a text on the progress bar.

这篇关于原因为什么一个WinForms标签不想是透明的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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