使用透明度/不透明度绘制文本 [英] Draw Text with Transparency / Opacity
本文介绍了使用透明度/不透明度绘制文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿朋友
如何使用透明度/不透明度的CDC绘制文字?
像水印 [ ^ ]在MFC中?
在Windows上可以选择使用类似
typedef DWORD(WINAPI * PSLWA)制作Windows Alpha Blend / Transparent(HWND, DWORD,BYTE,DWORD);
静态PSLWA pSetLayeredWindowAttributes = NULL;
static BOOL initialized = FALSE;
BOOL MakeWindowTransparent(HWND hWnd,unsigned char factor)
{
/ *首先,看看我们是否可以获得我们需要的API调用。如果我们尝试过
*一次,我们不需要再试一次。 * /
if(!initialized)
{
HMODULE hDLL = LoadLibrary(user32);
pSetLayeredWindowAttributes =
(PSLWA)GetProcAddress(hDLL,SetLayeredWindowAttributes);
initialized = TRUE;
}
/ * ...省略...... * /
}
有没有相关的文字方式?
问候
解决方案
< blockquote>也许这会对你有帮助
C ++ GDI +透明分层窗口上的绘图文字
http://stackoverflow.com/questions/4783781/c-gdi-drawing-text-on-a-透明分层窗口 [ ^ ]
Hey Friends
Any idea of how i can draw a text using CDC with Transparency / Opacity ?
Something like Watermarking[^] in MFC ?
On Windows there is option of making Windows Alpha Blend / Transparent using something like
typedef DWORD (WINAPI *PSLWA)(HWND, DWORD, BYTE, DWORD); static PSLWA pSetLayeredWindowAttributes = NULL; static BOOL initialized = FALSE; BOOL MakeWindowTransparent(HWND hWnd, unsigned char factor) { /* First, see if we can get the API call we need. If we''ve tried * once, we don''t need to try again. */ if (!initialized) { HMODULE hDLL = LoadLibrary ("user32"); pSetLayeredWindowAttributes = (PSLWA) GetProcAddress(hDLL, "SetLayeredWindowAttributes"); initialized = TRUE; } /* ... elided ... */ }
Is there any related way for Text ?
Regards
解决方案
Perhaps this will help you
C++ GDI+ drawing text on a transparent layered window
http://stackoverflow.com/questions/4783781/c-gdi-drawing-text-on-a-transparent-layered-window[^]
这篇关于使用透明度/不透明度绘制文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文