透明表盘?不透明表针?

dcbafei 2008-11-21 09:06:12
小弟菜鸟,请问大家,如何做一个透明表盘而表针是不透明的?我在对话框上做了个时钟,但都是不透明的。谢谢大家了!
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
dcbafei 2008-12-18
  • 打赏
  • 举报
回复
谢谢上面两位大哥,分不多,每人一点,算个意思,小弟新手,没多少分,谢谢!
DavidHsing 2008-11-23
  • 打赏
  • 举报
回复
The UpdateLayeredWindow function updates the position, size, shape, content, and translucency of a layered window.

Syntax

BOOL UpdateLayeredWindow( HWND hwnd,
HDC hdcDst,
POINT *pptDst,
SIZE *psize,
HDC hdcSrc,
POINT *pptSrc,
COLORREF crKey,
BLENDFUNCTION *pblend,
DWORD dwFlags
);
Parameters

hwnd
[in] Handle to a layered window. A layered window is created by specifying WS_EX_LAYERED when creating the window with the CreateWindowEx function.
hdcDst
[in]
Handle to a device context (DC) for the screen. This handle is obtained by specifying NULL when calling the function. It is used for palette color matching when the window contents are updated. If hdcDst isNULL, the default palette will be used.

If hdcSrc is NULL, hdcDst must be NULL.

pptDst
[in] Pointer to a POINT structure that specifies the new screen position of the layered window. If the current position is not changing, pptDst can be NULL.
psize
[in] Pointer to a SIZE structure that specifies the new size of the layered window. If the size of the window is not changing, psize can be NULL. If hdcSrc is NULL, psize must be NULL.
hdcSrc
[in] Handle to a DC for the surface that defines the layered window. This handle can be obtained by calling the CreateCompatibleDC function. If the shape and visual context of the window are not changing, hdcSrc can be NULL.
pptSrc
[in] Pointer to a POINT structure that specifies the location of the layer in the device context. If hdcSrc is NULL, pptSrc should be NULL.
crKey
[in] COLORREF structure that specifies the color key to be used when composing the layered window. To generate a COLORREF, use the RGB macro.
pblend
[in] Pointer to a BLENDFUNCTION structure that specifies the transparency value to be used when composing the layered window.
dwFlags
[in] This parameter can be one of the following values.
ULW_ALPHA
Use pblend as the blend function. If the display mode is 256 colors or less, the effect of this value is the same as the effect of ULW_OPAQUE.
ULW_COLORKEY
Use crKey as the transparency color.
ULW_OPAQUE
Draw an opaque layered window.
If hdcSrc is NULL, dwFlags should be zero.
Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

photosir 2008-11-23
  • 打赏
  • 举报
回复
这种做法只能用CRgn,然后对你的窗口SetWindowRgn,你可以先拿窗口做一个椭圆形的窗口试一下。基本思路是,根据时钟点计算当前Window的CRgn,再次SetWindowRgn
dcbafei 2008-11-23
  • 打赏
  • 举报
回复
我按zzz822163大哥的方法没试出来啊,TransparentBlt好像要用到位图,我不想用位图!哪位有UpdataLayeredWindow的例子,我再试试!
zzz822163 2008-11-22
  • 打赏
  • 举报
回复
用TransparentBlt
dcbafei 2008-11-22
  • 打赏
  • 举报
回复
谢谢这位大哥,我试试:)

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧