简体   繁体   English

更改Windows窗体的形状并引发自定义事件

[英]Changing shape of windows form and raise custom event

I am creating an application like "Rocket Dock. I want to 我正在创建一个“ Rocket Dock”应用程序。

1) Change the default shape of the windows form. 1)更改Windows窗体的默认形状。 Like curve edges etc. 2) How can I raise event so that when I move cursor to the top of the screen, my app appears and when leave the interface it moves upward and disappear? 像曲线边缘等。2)如何引发事件,以便当我将光标移到屏幕顶部时,我的应用程序出现,而当离开界面时,它向上移动并消失?

1) There are a couple of ways to create a custom WinForm shape 1)有两种创建自定义WinForm形状的方法

1a) Set the form's background to an image and use a transparency key: 1a)将表单的背景设置为图像,并使用透明键:
http://msdn.microsoft.com/en-us/library/aa289517%28v=vs.71%29.aspx http://msdn.microsoft.com/zh-cn/library/aa289517%28v=vs.71%29.aspx

1b) Define a custom shape using System.Drawing and set the forms region to your newly created path: http://codegod.org/WebAppCodeGod/Creating-Custom-Shapes-for-Forms-in-Windows-Forms-AID377.aspx 1b)使用System.Drawing定义自定义形状,并将表单区域设置为新创建的路径: http : //codegod.org/WebAppCodeGod/Creating-Custom-Shapes-for-Forms-in-Windows-Forms-AID377.aspx

2) Collapse your form to a very small size and hook the MouseEnter (or MouseHover) event to trigger the "entering" effect. 2)将表单折叠到很小的尺寸,并钩住MouseEnter(或MouseHover)事件以触发“输入”效果。 You can hook the Form's MouseLeave event to trigger the "leaving" effect. 您可以挂钩窗体的MouseLeave事件以触发“离开”效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM