Create a window like app using c # and wpf

I need to create an application similar to the one we get when we buy a laptop. It will only be visible when the mouse pointer reaches the top of the window. So how can I do this using C # 4.0? this link u can see the app. I need to create this type Any ideas pls share. Thanks to


source to share

2 answers

I guess there are several ways to achieve this effect:

  • You can place a portion of your application window above the visible screen so that only a portion of it is visible (say, you can only see it at the bottom). Then you need to handle events when the mouse enters ( MouseEnter

    ) and leaves ( MouseLeave

    ) the form to move the form up and down.
  • You can use a background thread to call the method GetCursorPos

    at a specified interval (i.e. every 500ms) to check where the mouse is currently. See this link for more information on this and sample code: . (If you only need to check the position of the mouse, you can use a timer to simplify your application.)


When you click what's possible in C #, you can always start calling your own code - like the windows API. Since you're not asking a specific question, I'll leave you with:

  • Position your app where you want to display it and hide it.
  • Capturing mouse position using api api (see this "SO" answer )
  • When the mouse is in the corner of the screen / top, etc .; make your application visible.

Now make sure it all works with a dual screen setup and you're done.



All Articles