using_20transparent_20windows
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_20transparent_20windows [2018/03/31 13:19] – external edit 127.0.0.1 | using_20transparent_20windows [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Using transparent windows===== | =====Using transparent windows===== | ||
- | //by Richard Russell, August 2006//\\ \\ **This article is not applicable to Windows 9x, Windows Me or Windows NT4.**\\ \\ Normally the main output window of your BASIC program has an opaque background, hiding anything ' | + | //by Richard Russell, August 2006//\\ \\ **This article is not applicable to Windows 9x, Windows Me or Windows NT4.**\\ \\ Normally the main output window of your BASIC program has an opaque background, hiding anything ' |
* Window shapes that are (apparently) not rectangular | * Window shapes that are (apparently) not rectangular | ||
* Desktop gadgets (e.g. a clock) that are not contained within a frame | * Desktop gadgets (e.g. a clock) that are not contained within a frame | ||
* Drawing over the entire desktop area | * Drawing over the entire desktop area | ||
- | \\ | + | |
+ | Creating a window with a transparent background is fairly straightforward. Firstly you should remove the normal window title bar and frame border since otherwise these will still be visible. You can do that with the following code: | ||
+ | |||
+ | <code bb4w> | ||
GWL_STYLE = -16 | GWL_STYLE = -16 | ||
SWP_NOSIZE = 1 | SWP_NOSIZE = 1 | ||
Line 17: | Line 20: | ||
SYS " | SYS " | ||
VDU 26 | VDU 26 | ||
- | Note that doing this will prevent the user moving, resizing, minimising, maximising or closing the window since the usual controls are absent. The window can still be closed with **Alt-F4** but otherwise you should provide the necessary controls within your program.\\ \\ If you prefer to change the position and size of your window at the same time (particularly since the user cannot do so) you can do that as follows:\\ \\ | + | </ |
+ | |||
+ | Note that doing this will prevent the user moving, resizing, minimising, maximising or closing the window since the usual controls are absent. The window can still be closed with **Alt-F4** but otherwise you should provide the necessary controls within your program.\\ \\ If you prefer to change the position and size of your window at the same time (particularly since the user cannot do so) you can do that as follows: | ||
+ | |||
+ | <code bb4w> | ||
GWL_STYLE = -16 | GWL_STYLE = -16 | ||
SWP_FRAMECHANGED = 32 | SWP_FRAMECHANGED = 32 | ||
Line 26: | Line 33: | ||
SYS " | SYS " | ||
VDU 26 | VDU 26 | ||
- | where **x%**, **y%** are the desired position of your window and **dx%**, | + | </ |
+ | |||
+ | where **x%**, **y%** are the desired position of your window and **dx%**, | ||
+ | |||
+ | <code bb4w> | ||
GWL_STYLE = -16 | GWL_STYLE = -16 | ||
SWP_FRAMECHANGED = 32 | SWP_FRAMECHANGED = 32 | ||
Line 37: | Line 48: | ||
SYS " | SYS " | ||
VDU 26 | VDU 26 | ||
- | Next you must nominate a ' | + | </ |
+ | |||
+ | Next you must nominate a ' | ||
+ | |||
+ | <code bb4w> | ||
COLOUR 128+8 | COLOUR 128+8 | ||
CLS | CLS | ||
- | If you prefer to specify your own RGB colour, rather than using one of the predefined palette entries, you can do that as follows:\\ \\ | + | </ |
+ | |||
+ | If you prefer to specify your own RGB colour, rather than using one of the predefined palette entries, you can do that as follows: | ||
+ | |||
+ | <code bb4w> | ||
COLOUR 8, | COLOUR 8, | ||
COLOUR 128+8 | COLOUR 128+8 | ||
CLS | CLS | ||
- | Where **red%**, **green%** and **blue%** are the colour components, each in the range 0-255. Any other method of clearing the background to your desired ' | + | </ |
+ | |||
+ | Where **red%**, **green%** and **blue%** are the colour components, each in the range 0-255. Any other method of clearing the background to your desired ' | ||
+ | |||
+ | <code bb4w> | ||
GWL_EXSTYLE = -20 | GWL_EXSTYLE = -20 | ||
WS_EX_LAYERED = &80000 | WS_EX_LAYERED = &80000 | ||
Line 51: | Line 74: | ||
SYS " | SYS " | ||
SYS " | SYS " | ||
+ | </ | ||
+ | |||
That's all there is to it. Anything you write to your window in a colour other than the nominated ' | That's all there is to it. Anything you write to your window in a colour other than the nominated ' |
using_20transparent_20windows.1522502391.txt.gz · Last modified: 2024/01/05 00:16 (external edit)