使用 datagridview winform 将具有不透明度的表单放置在主表单上
我有一个带有 datagridview 的表单(名为 mainForm.cs)。
我必须在 datagrdiview 上显示图片(具有不透明度)。为了实现这一点,我制作了另一个带有图片框的表单(frmPicture),并将不透明度属性应用于该表单。当鼠标进入窗体(frmPicture)时,它还设置不透明度= 100,当鼠标离开窗体时,它还设置不透明度= 30。我们需要在点击时调整大小。
问题是当我最小化 mainForm 时,其他窗体仍然在其位置。
当方法出现在列表中(键入点后)并按 Control 键更改列表的不透明度时,我必须找到像 Visual Studios 那样的方式。
我希望任何人都可以帮助我。
提前致谢。
此致。
I have a form (named mainForm.cs) with a datagridview on it.
I must to show a picture (with opacity) over a datagrdiview. To achieve this, I made another form (frmPicture) with a picturebox, and apply the opacity property to the form. It also set the opacity = 100 when the mouse get inside the form (frmPicture) and opacity = 30 when the mouse leave the form. And we need to resize on click.
The problem is when I minimize the mainForm, the other form is still in their place.
I must to find the way like Visual Studios does when the methods appears in a list (after typing a dot) and pressing the Control key to change the opacity of a list.
I hope anybody can help me.
Thanks in advance.
Best regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果将主窗体设置为被覆盖窗体的所有者,则它将随主窗体一起最小化,即
If you set the Main form as the owner of the form being overlayed, it will minimize with the Main form, i.e.
我敢打赌 VS 使用 ContextMenu 或新的 ContextMenuStrip,而不是其他形式...
编辑 - 删除不好的建议
但是,对于您现在面临的情况,我将使用表单的 Deactivate() 事件,并在该事件处理程序中隐藏其他表单。这样当你的表单失去焦点时它就会像 VS 一样隐藏起来。
I would bet VS uses a ContextMenu or the new ContextMenuStrip, not another form....
Edit - deleted bad advice
HOWEVER, for the situation you're facing now, I would use the Form's Deactivate() event, and hide your other form in that event handler. This way it will hide when your form goes out of focus just like VS.