Without that simple formula, trying to figure out if the mouse click actually hit inside the cloud-shaped form can be a huge computational task! But there is an easier method.Ī layered window, when drawn, is not drawn directly to the screen. The window "frame" is a random line that can't be described in a simple mathematical formula. But, in our cloud-shaped window, there is no usable bounds to check where the mouse clicked. It's very easy to determine which window actually got clicked on. Everywhere you click between the top-left corner and bottom-right corner of a window falls within the bounds of that window. Well, with normal, plain-old windows, every window is rectangular in shape. Take the example of a window with a random blob shape, sort of like a cloud. With some playing around, you can discover that windows, with the Transparency bit set, are invisible to mouse clicks! It's supposed to be not just anywhere you click on a form (window). It takes some trial and error to figure out what's really going on. That's the only description of what this bit does. What on earth does that mean? Well, it's not defined anywhere. It goes on to say that this window will also get the Paint message ( WM_PAINT) only after all the sibling windows (in the same application) beneath it have received and processed their Paint messages. Its definition in the documentation on MSDN says that all windows beneath this window will not be obscured by this window. The WS_EX_TRANSPARENT extended window style bit is poorly documented. I'll also show you how to use the SetLayeredWindowAttribute function to change the opacity of the window to make them "see-through" as well as "click-through". NET Framework Form windows into Layered Windows. I'll show you how to use these functions to set the WS_EX_LAYERED and WS_EX_TRANSPARENT window extended attributes to turn your. Most of these attributes can be set or reset at any time, either during or after the window is created, by calling the Win32 API functions GetWindowLong and SetWindowLong. When a window is created, it has a standard set of attributes attached to it, like its name, position, size, style, and window handle, among others. All these UI effects, and more, were made possible with the introduction of a new extended window style, called Layered Windows, in Windows 2000 Beta 3. You may have noticed some of these improvements, like the little shadow that now lies under the mouse pointer, fade-in and -out menus and ToolTips, alpha-blended dragging of objects around the Shell (Explorer), non-rectangular window shapes, and visually transparent (or alpha-blended) windows, to name a few. With the introduction of Windows 2000, the User Interface (UI) got a much needed face-lift through prettier graphics and ease-to-use improvements. I'll discuss how these Layered Windows work, and how to use them to pull off a "click-through" window in your Windows Forms applications. It's pretty easy if you know the correct attributes and how to apply them to your form! The trick lies in "Layered Windows". Have you ever wondered how to make a form ignore the mouse so the clicks get sent to the application, or whatever else, is behind your form? Perhaps you want to create an application that overlays a window with one of your own, but you wanted your window to be "transparent" to the mouse.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |