在 Win32 中将图像放置在 CEdit 控件内

发布于 2024-08-23 07:58:50 字数 138 浏览 1 评论 0原文

我试图实现这样的效果:编辑控件内有一个可见的徽标,当用户将焦点放在编辑控件上时,该徽标将被隐藏。

解决这个问题的最佳方法是什么?将图像控件放置在编辑控件的顶部或将编辑控件的背景绘制为透明并将图像控件放置在编辑控件后面会更好吗?或者可能有其他方法?

I'm trying to achieve an effect where there's a visible logo inside an edit control and the logo becomes hidden when the user places the focus on the edit control.

What's the best way to approach this? Would it be better to place an image control on top of the edit control or paint the background of the edit control transparent and position the image control behind the edit control? Or possibly some other method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水中月 2024-08-30 07:58:50

EDIT 控件的绘制行为非常糟糕,您永远无法通过覆盖 WM_PAINT 消息处理程序或使用透明度来实现这一点。是的,用一个静态控件覆盖它,当您看到正在输入的文本时隐藏该控件。

The EDIT control has very broken paint behavior, you'll never get there by overriding the WM_PAINT message handler or using transparency. Yes, overlay it with a STATIC control that you hide when you see text being entered.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文