使用 datagridview winform 将具有不透明度的表单放置在主表单上

发布于 2024-09-13 18:53:15 字数 372 浏览 4 评论 0原文

我有一个带有 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 技术交流群。

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

发布评论

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

评论(2

一个人的旅程 2024-09-20 18:53:15

如果将主窗体设置为被覆盖窗体的所有者,则它将随主窗体一起最小化,即

     OverlayForm form = new OverlayForm();
     form.Show(this);

If you set the Main form as the owner of the form being overlayed, it will minimize with the Main form, i.e.

     OverlayForm form = new OverlayForm();
     form.Show(this);
孤独岁月 2024-09-20 18:53:15

我敢打赌 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.

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