求《英伦魔法师 百度网盘对决》高清完整版百度云网盘资源O(∩_O谢谢

I used to do the transparent background with javax.swing.JLabel this way:
lbl.setBackground(new Color(0, 0, 0, 0));.
But it doesn't work with java.awt.Label. Is there any simple way to make the label transparent?
public class SplashBackground extends Panel {
private static final long serialVersionUID = 1L;
private Image image =
* This is the default constructor
public SplashBackground() {
initialize();
* This method initializes this
private void initialize() {
image = Toolkit.getDefaultToolkit().createImage(getClass().getResource("/splash/splash.jpg"));
this.setLayout(null);
public void paint(Graphics g) {
super.paint(g);
if(image != null) {
g.drawImage(image, 0,0,this.getWidth(),this.getHeight(),this);
lbl= new Label();
lbl.setBackground(new Color(0, 0, 0, 0));
splashBackground = new SplashBackground();
splashBackground.add(appNameLabel, null);
解决方案 I can see why you do not want to load Swing, since it is for a splash.
Sun/Oracle's own implementation of
is AWT all the way.
Why not just use that existing class for your splash functionality?
As mentioned by camickr, see
for an example.
Now that's what I'm talking about.
As to the labels, leave them out.
Use FontMetrics or (better) TextLayout to determine the size/position of the text, then just paint it directly to the Image.
For an example of using the TextLayout class, see
to 'Java2D Graphics anti-aliased'.
本文地址: &
我以前做的透明背景javax.swing.JLabel中是这样的:
lbl.setBackground(新颜色(0,0,0,0)); 。 但是它不与java.awt.Label中工作。有没有简单的方法,使标签透明? 更新:
公共类SplashBackground扩展面板{
私有静态最后的serialVersionUID长1L =;
私人形象画像= NULL;
*这是默认的构造函数
公共SplashBackground(){
初始化();
*这个方法初始化此
私人无效初始化(){
。图像= Toolkit.getDefaultToolkit()的createImage(的getClass()的getResource(“/飞溅/ splash.jpg”));
this.setLayout(NULL);
公共无效漆(图形G){
super.paint(G);
如果(形象!= NULL){
g.drawImage(图像,0,0,this.getWidth(),this.getHeight(),这一点);
LBL =新的Label();lbl.setBackground(新的色彩(0,0,0,0));splashBackground =新SplashBackground();splashBackground.add(appNameLabel,NULL); 解决方案 我明白为什么你不希望加载秋千,因为它是一个轰动。太阳/ Oracle自己的执行是AWT的所有道路。 为什么不直接使用现有类的防溅功能?正如camickr提到的,请参见来“的Java2D图形消除锯齿”。
本文地址: &
扫一扫关注官方微信赞助商链接
我们的产品
copyright & 2008 - 20145158人阅读
QT中几种设置控件的图片背景的方法
杯具了,直到今天才发现有不少种可以加载图片的方法。
下面简单总结下:
1 MLCNWidget *w=new MLCNW
w-&setAutoFillBackground(true);
palette.setBrush(w-&backgroundRole(), QBrush(QPixmap(&./pic/new_images/bg.jpg&)));
w-&setPalette(palette);
w-&showFullScreen();
控件-&setStyleSheet(&background-image:url(./pic/new_images/start_jiankong.png)&);
这样做的一个缺点是一旦在一个控件中使用StyleSheet了,其中的子控件就全部会继承,也就是在上面显示主控件的背景了。在网上看到可以通过*{}的方式防止继承,但我试了下,没成功,不知道到底行不行。
3 关于label上加图片的
估计除了widget,加的最多的就是QButton和QLabel了,QLabel里面看QT文档可以发现有个槽,setPixmap,用了下,特别好用。
ui.label_5-&setPixmap(QPixmap(&./pic/new_images/start_jiankong.png&));
唉,以前咋没发现这个好方法呢?
不过还好,现在知道了。
学习就是多发现,多摸索,多总结的过程。
QT中使用QPalette QBrush设置控件背景需要注意的一点
最近在做的项目中用到了这么一个地方,在一个widget中的一个label控件上加图片,但是我在widget中使用的stylesheet设置的背景图片,于是在label上再加就没法加了。这点很是郁闷,于是想起使用QPalette 和QBrush进行设置背景,结果发现,老是黑屏。
网上百度了下,发现可能少了行代码,一试,果然如此。
ui.widget-&setAutoFillBackground(true);
QPalette palette= ui.widget-&palette();
palette.setBrush(QPalette::Window,QPixmap(&./pic/new_images/uppage.jpg&));
ui.widget-&setPalette(palette);
如题,就是最上面一行的红字的部分,这行一定不能少。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:153512次
积分:1991
积分:1991
排名:第15947名
原创:38篇
转载:55篇
评论:31条
(1)(1)(2)(5)(4)(2)(1)(1)(2)(7)(2)(1)(5)(8)(5)(1)(1)(2)(1)(2)(1)(4)(10)(1)(5)(1)(4)(2)(9)(1)(1)请教:如何使QScrollArea的背景透明,并且不影响子控件? - QTCN开发网 - Powered by phpwind
查看完整版本: [--
请教:如何使QScrollArea的背景透明,并且不影响子控件?
我用的Qt Creator,Qt版本是4.8.1,操作系统环境是Ubuntu 10.04。会使用QSS编写样式表,懂得QSS基本语法。目前在编写一个软件界面,为了方便,所有QSS样式均写在独立的QSS文件中。 现在开发一个的软件界面,需要用到QScrollArea。为了美观,需要将它显示内容的区域背景色变成为透明。 我知道使用样式表background-color:transparent 可以使控件背景透明:scrollArea-&setStyleSheet(QString::fromUtf8(&background-color:&));也知道像上面一样的这样设置会使,scrollArea所包含的所有子控件的背景也变成透明。 但百思不得其解的是: (1)直接在程序里调用QScrollArea的setStyleSheet()设置ScrollArea的样式表会有效果,但在我的QSS文件里这样写就没效果。QScrollArea#scrollArea { background-color: }&&&&&&是不是Qt不支持ScrollArea的QSS语法? (2)如何设置QScrollArea,让它只有内容区域的background是透明的,它的子控件包括滚动条的background不受影响?
我也遇到同一个问题,楼主解决了吗?
目前暂时还没找到方法。已经考虑用QAbstractScollArea创建自定义类了。
qss 肯定是支持的 不知道你在细节上怎么搞的
我试了一下,qss里设置QWidget#sourceEditWidget,#sourceScrollArea,#scrollAreaWidgetContents{&&&&background-color:}是可以用的
查看完整版本: [--
Powered by
Gzip disabled

我要回帖

更多关于 英伦对决百度云 的文章

 

随机推荐