Excel ActiveX 标签在单击时闪烁/更改样式
这似乎是一个小故障,多年来一直困扰着我。某些 ActiveX 控件放置在工作表上时,单击时会执行奇怪的操作。下图中,没有任何代码,Label1 被禁用,但是当单击 Label1 时,Label2 消失。我还看到点击后深色标签变成白色。我知道防止这种情况的唯一方法是使用子类化/挂钩来拦截和取消标签上的 wm_mousedown 消息,但对于这样一个简单的目标来说,这是大量的工作。有人对此有一个简单的解决方案吗?
*编辑:我相信发生的事情是 z 顺序/z 索引将单击的控件带到顶部。但如果有办法防止这种情况发生,我很想知道如何做。
以下是单击标签时背景颜色发生变化的示例。请参阅标题为“原始值:”的标签
This, what seems to be a glitch, has annoyed me for years. Some ActiveX controls, when placed on the worksheet, do odd things when clicked. In the picture below, there is no code whatsoever and Label1 is disabled, but when Label1 is clicked, Label2 disappears. I've also seen dark labels turn white upon clicking. The only way I know of to prevent this would be to use subclassing/hooking to intercept and cancel wm_mousedown messages when over the label but that is a ton of work for such a simple goal. Does anybody out there have a simple solution for this?
*Edit: I believe what's happening is the z-order/z-index brings the clicked control to the top. But if there's a way to prevent this I would love to know how.
Here is an example of the background color changing when a label is clicked. See the label with the caption "Original Value:"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
项目应保持其布局顺序,我有许多具有重叠菜单、形状和标签的项目,它们都保持其组织的图层顺序,它们唯一移动的时间是您以编程方式重新创建它们以更新菜单时等等,然后你需要编写代码将它们从下到上按顺序放回原处。如果它们没有保持秩序,那么就会出现问题,而不是设计缺陷。
Items should stay in the order they were laid out in, I have many projects with overlapping menus, shapes and labels and they all stay in the layer order they are organised in, the only time they move is if you programatically recreate them to update menues etc, then you need to write code to put them all back in order starting from the bottom up. If they are not staying in order then there is a problem and not a design flaw.