User Tools

Site Tools


changing_20the_20mdi_20background_20colour

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

changing_20the_20mdi_20background_20colour [2018/03/31 13:19]
127.0.0.1 external edit
changing_20the_20mdi_20background_20colour [2018/04/16 14:42] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Changing the MDI background colour===== =====Changing the MDI background colour=====
  
-// by Richard Russell, March 2007//\\ \\  If your program uses a **Multiple Document Interface**,​ by means of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​mdilib|MDILIB library]], the background of the **MDI client** area is filled with the **COLOR_APPWORKSPACE** system colour, which by default is a mid-grey. Although you can change this colour in Windows Control Panel that will affect all applications,​ which you probably don't want to do.\\ \\  It is possible to change the **MDI client** background colour just for your program by //​subclassing//​ its window procedure. To do that you can use the following procedure:\\ \\ +// by Richard Russell, March 2007//\\ \\  If your program uses a **Multiple Document Interface**,​ by means of the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​mdilib|MDILIB library]], the background of the **MDI client** area is filled with the **COLOR_APPWORKSPACE** system colour, which by default is a mid-grey. Although you can change this colour in Windows Control Panel that will affect all applications,​ which you probably don't want to do.\\ \\  It is possible to change the **MDI client** background colour just for your program by //​subclassing//​ its window procedure. To do that you can use the following procedure: 
 + 
 +<code bb4w>
         DEF PROCsubclassmdiclient         DEF PROCsubclassmdiclient
         LOCAL E%, M%, O%, P%         LOCAL E%, M%, O%, P%
Line 29: Line 31:
         SYS "​SetWindowLong",​ @hmdi%, -4, M%         SYS "​SetWindowLong",​ @hmdi%, -4, M%
         ENDPROC         ENDPROC
-You should call this procedure immediately after initialising the Multiple Document Interface, as follows:\\ \\ +</​code>​ 
 + 
 +You should call this procedure immediately after initialising the Multiple Document Interface, as follows: 
 + 
 +<code bb4w>
         PROC_initmdi(hWindowMenu%)         PROC_initmdi(hWindowMenu%)
         MDIBkgdCol% = &800000         MDIBkgdCol% = &800000
         PROCsubclassmdiclient         PROCsubclassmdiclient
-The MDI background colour will be set to whatever RGB value you load into **MDIBkgdCol%**,​ which in the above example is a dark blue.\\ \\  If you want to change the **MDI client** colour whilst your program is running, you will need to use code similar to the following to force the background to be refreshed:\\ \\ +</​code>​ 
 + 
 +The MDI background colour will be set to whatever RGB value you load into **MDIBkgdCol%**,​ which in the above example is a dark blue.\\ \\  If you want to change the **MDI client** colour whilst your program is running, you will need to use code similar to the following to force the background to be refreshed: 
 + 
 +<code bb4w>
         MDIBkgdCol% = &008000         MDIBkgdCol% = &008000
         SYS "​InvalidateRect",​ @hmdi%, 0, 1         SYS "​InvalidateRect",​ @hmdi%, 0, 1
 +</​code>​
changing_20the_20mdi_20background_20colour.txt · Last modified: 2018/04/16 14:42 by richardrussell