I recently added a feature to the LitDev Extension to create a completely transparent GraphicsWindow.
The method to do this is:
I can’t show a screenshot because there is absolutely nothing to see!
So, what’s the point…
Well, anything we add to the transparent GraphicsWindow will be visible, so we can do things like:
- Create a window with a non-rectangular shape by drawing a png image.
- Create nice simple widget applications.
- Make things appear to float free from a containing window.
- The transparent GraphicsWindow must be created before any other command creates a GraphicsWindow.
- Once a transparent GraphicsWindow is created it cannot be changed back to a normal GraphicsWindow.
- Because the window is completely transparent, it doesn’t even register Mouse Clicks or other events unless something is drawn on it or its background is modified with GraphicsWindow.BackgroundColor.
- A partially transparent color can be created using the hex format with the first 2 characters being opacity (e.g. “#01FFFFFF” is almost completely transparent white – you won’t see it but it will register events if used as a background).
- You can add anything to the transparent GraphicsWindow that you would to a normal one, including drawings, shapes and controls as well as move, rotate, show/hide and zoom (everything you can do normally).
- You can use the associated new method LDUtilities.TopMostGW(“True”) to ensure that the window always remains above all other windows, good for widgets.
The following is the code for a simple clock widget using these methods.
The partially transparent clock floats above all windows, it can be moved by grabbing with a mouse click and dragging. A right click gives an option to exit it.
With these basic code segments you can create your own fancy professional looking widgets, perhaps with options to change and store settings.