使用C#和WPF创建应用程序一样码头 [英] Create a dock like application using C# and wpf

查看:129
本文介绍了使用C#和WPF创建应用程序一样码头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要建立类似于那些我们将得到当我们购买一台笔记本电脑的应用程序。只有当鼠标指针到达该窗口的顶部将是可见的。那么,怎样才能我能够使用C#4.0中做到这一点? http://www.notebookcheck.net/uploads/pics/win2_12.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 ? http://www.notebookcheck.net/uploads/pics/win2_12.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 )和叶(鼠标离开 <$ C C $>)的形式来移动窗体向上和下降。
  • 您可以使用一个后台线程调用 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.)

这篇关于使用C#和WPF创建应用程序一样码头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆