开发者

place a form with Opacity over a main form with datagridview winform

开发者 https://www.devze.com 2023-01-10 21:36 出处:网络
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 appl

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.


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);


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号