由网友(救人无数歪脖树)分享简介:我需要建立类似于那些我们将得到当我们购买一台笔记本电脑的应用程序。只有当鼠标指针到达该窗口的顶部将是可见的。那么,怎样才能我能够使用C#4.0中做到这一点?http://www.notebookcheck.net/uploads/pics/win2_12.jpg 此链接ü可以看到应用程序。我需要创建这种类型的任何想...
我需要建立类似于那些我们将得到当我们购买一台笔记本电脑的应用程序。只有当鼠标指针到达该窗口的顶部将是可见的。那么,怎样才能我能够使用C#4.0中做到这一点? https://p.xsw88.cn/allimgs/daicuo/20230905/520.png.jpg 此链接ü可以看到应用程序。我需要创建这种类型的 任何想法,请分享。谢谢
I need to create a application which is similar to those we will get when we buy a laptop. It will be visible only when the mouse pointer reaches the top of the window. So how can I able to do this using C# 4.0 ? https://p.xsw88.cn/allimgs/daicuo/20230905/520.png.jpg this link u can see the application. I need to create such type Any idea pls share. Thanks
推荐答案
我想有几种不同的方式来实现这种效果:
I suppose there are several different ways to achieve this effect:
您可以将您的应用程序上面的可视屏幕的窗口的一部分,所以它只是一个部分是可见的(假设你只能看到它的底部)。然后,你需要处理的事件,当鼠标进入(的MouseEnter
)和叶(鼠标离开 )的形式来移动窗体向上和下降。
您可以使用一个后台线程调用 GetCursorPos
方法,在设定的时间间隔(即每500毫秒)第二次检查,其中当前鼠标。看到这个链接,它和一个示例code的更多信息: HTTP:// WWW .pinvoke.net / Default.aspx的/ user32.getcursorpos 。
(如果您只需要点击鼠标的位置,你可以用一个定时器来简化你的应用程序。)
You can place part of the window of your application above the visible screen, so only a part of it is visible (let's say you can see only it's bottom). Then you need to handle events when mouse enters (MouseEnter
) and leaves (MouseLeave
) the form to move the form up and down.
You can use a background thread to call GetCursorPos
method at a set interval (i.e. each 500ms) second to check where currently the mouse is. See this link for more information about it and a sample code: http://www.pinvoke.net/default.aspx/user32.getcursorpos.
(If you need only to check the mouse position, you can use a timer to simplify you application.)相关推荐
最新文章