使整个优化校准透明 [英] Make entire Picture Control Transparent

查看:65
本文介绍了使整个优化校准透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我尝试以下情况很长一段时间但无法成功。

输入:对话框2图片控件,mfcbutton,滑块控件和几个按钮。



1.我需要添加一个jpg图像作为我对话框的完整背景。

解决方案:我通过使用CImagePreviewStatic实现了这一目标。

以下是链接:

https://www.google.co.in/ ?URL SA = T&安培; RCT = J&安培; q =&安培; ESRC = S&安培;源=纸幅放大器; CD = 2及VED = 0CCMQFjABahUKEwiehpHWmYXGAhULq7wKHeNQABo&安培; URL = HTTP%3A%2F%2Fwww.codeproject.com%2FArticles%2F6354%2FA-简单的图像预览类使用-GDI & ei = XDd4VZ7oMovW8gXjoYHQAQ& usg = AFQjCNEcO0kiW8Ie-voNfaGMIDB2P3D0Ig& bvm = bv.95039771,d.dGc& cad = rja [ ^ ]

这对我来说很好。



2.第二个图片控件位于第一个顶部 - 我有一个Bitmap附加或者我使用OnPaint()绘制温度测量等图形,使用SolidBrush绘制折线等。



基于Slider控件输入,我现在想要第2个图片控件透明,它会以某种最大值消失。

另外,我提到的mfcbutton是一个位图添加ed,甚至它的透明度应该相对于滑块控制值而改变。



我只使用Visual Studio 2010和MFC C ++。



如果您知道任何解决方案,请告诉我。

提前谢谢。

Hi All,

I am trying the below scenario since a long time but unable to succeed.
Inputs: Dialog box with 2 Picture controls, mfcbutton, slider control and few buttons.

1. I need to add a jpg image as complete background of my dialog box.
Solution: I have achieved this by using CImagePreviewStatic.
Below is the link:
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CCMQFjABahUKEwiehpHWmYXGAhULq7wKHeNQABo&url=http%3A%2F%2Fwww.codeproject.com%2FArticles%2F6354%2FA-simple-image-preview-class-using-GDI&ei=XDd4VZ7oMovW8gXjoYHQAQ&usg=AFQjCNEcO0kiW8Ie-voNfaGMIDB2P3D0Ig&bvm=bv.95039771,d.dGc&cad=rja[^]
This is working fine for me.

2. 2nd picture control is positioned centered on top of 1st- I have an Bitmap attached or I draw a graph like temperature measurement etc using OnPaint() with SolidBrush to draw polylines etc.

Based on the Slider control input, I now want to make this 2nd picture control transparent in a way that it fades to some maximum value.
Also, the mfcbutton that I mentioned is having a bitmap added, even its transparency should change with respect to slider control value.

I am using Visual Studio 2010 and MFC C++ only.

Please let me know if you are aware of any solutions.
Thank you in advance.

推荐答案

最后,我很高兴发布这个答案。

分层Windows对我来说真是太棒了。



这已经解决了。



我用过:

Finally, its my pleasure to post this answer.
Layered Windows as worked just so amazing for me.

This is resolved.

I have used:
// Make this window 70% alpha
SetLayeredWindowAttributes(hwnd, 0, (255 * 70) / 100, LWA_ALPHA);



如果我希望对话框中的剩余区域变得透明,我将只添加RGB颜色并在最后一个参数中添加LWA_ALPHA | LWA_COLORKEY



我在Slider Control的VScroll事件中添加了这个。这样,alpha百分比可以通过滑块控件的位置来控制。


If I want the remaining area on the dialog to be made transparent, I will just add the RGB color and in last parameter LWA_ALPHA | LWA_COLORKEY

I have added this on VScroll event of the Slider Control. So that the alpha percentage can be controlled by the position of the slider control.


这篇关于使整个优化校准透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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