------------------------------------------------------------------------------------------
                      [BUG/PRB.] VFP 9.0 FIX - FIX THE OPTIONBUTTON CAPTIONS ARE DISPLAYED WITH SHADOW
                                 January 2024
                 ------------------------------------------------------------------------------------------
                                     CCB



1. BUG:

     In vfp9 (and vfp6, vfp7, vfp8), if we set the OptionButton.BackStyle property to 0 (Transparent), sometimes the optionbutton captions are displayed with shadow.

     The bug only occurs when the OptionButton.BackStyle property is 0 (Transparent), it does not occur when the OptionButton.BackStyle property is 1 (Opaque).

     The bug only occurs for some fonts, for example,
     Arial, Consolas, Courier New, Impact, Lucida Console, Microsoft Sans Serif, Segoe UI, Symbol, Tahoma, Times New Roman, Simfang, Simhei, Simkai, Msyh,
     it does not occur for other fonts, for example,
     Courier, Fixedsys, MS Sans Serif, MS Serif, Modern, Roman, Script, Small Fonts, System, Terminal, Simsun.

     The bug only occurs when we select the "Turn on ClearType" checkbox in the Windows Control Panel,
     it does not occur when we don't select the "Turn on ClearType" checkbox in the Windows Control Panel.

     The bug was reported by Ravil.

     In vfp9, sometimes the optionbutton captions are displayed with shadow, please refer to the picture testoptionbuttonbackstyle-vfp9.jpg:


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label4e5cb9 ::
             mov  eax , dword ptr [ esp + 20 ]                               ;0x004e5cb9 :        8b442414
             test eax , eax                                                  ;0x004e5cbd :        85c0
             mov  edi , dword ptr [ esp + 24 ]                               ;0x004e5cbf :        8b7c2418
             jne Label4e5ceb                                                 ;0x004e5cc3 :        7526
             pushd 01h                                                       ;0x004e5cc5 :        6a01
             mov eax , edi                                                   ;0x004e5cc7 :        8bc7
             call Fun47d7e3                                                  ;0x004e5cc9 :        e8157bf9ff
             test eax , eax                                                  ;0x004e5cce :        85c0
             je Label4e5ceb                                                  ;0x004e5cd0 :        7419
             pushd 0191h                                                     ;0x004e5cd2 :        6891010000
             mov edx , 034Ah                                                 ;0x004e5cd7 :        ba4a030000
             mov ecx , edi                                                   ;0x004e5cdc :        8bcf
             call Fun429844                                                  ;0x004e5cde :        e8613bf4ff
             test eax , eax                                                  ;0x004e5ce3 :        85c0
             je Label4e634d                                                  ;0x004e5ce5 :        0f8462060000

     Label4e5ceb ::
             cmp  dword ptr [ esi + 0154h ] , 01h                            ;0x004e5ceb :        83be5401000001
             je Label452918                                                  ;0x004e5cf2 :        0f8420ccf6ff
             pushd 01h                                                       ;0x004e5cf8 :        6a01
             push esi                                                        ;0x004e5cfa :        56
             lea edi ,  dword ptr [ esp + 090h ]                             ;0x004e5cfb :        8dbc2490000000
             call Fun4e51da                                                  ;0x004e5d02 :        e8d3f4ffff


     ;
     ;                 -------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE OPTIONBUTTON CAPTIONS ARE DISPLAYED WITH SHADOW
     ;                                  August 2021
     ;                 -------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; If we set the OptionButton.BackStyle property to 0 (Transparent), sometimes the optionbutton captions are displayed with shadow.
     ;
     ; 2021/8/14, by ccb
     ;

             mov dword ptr vfpa_optionbuttoncaption_isoptionbuttoncaption,00h

             cmp dword ptr vfpa_sys9067_data,00h
             je Label4e5d07

             cmp dword ptr [ esi + 4 ] , 0335h
             jne Label4e5d07
             ; mov  eax , dword ptr [ esp + 24 ]
             ; mov  ecx , dword ptr [ Data9388dc ]
             ; lea eax ,  dword ptr [ eax + 4 * eax ]
             ; shl eax , 05h
             ; cmp  word ptr [ eax + ecx + 16 ] , 0335h
             ; jne Label4e5d07

             push edi
             mov edi , dword ptr [ esp + 24 ][04h]
             call vfpa_getformvisible
             pop edi
             cmp eax , 00h
             jle Label4e5d07

             sub esp , 10h
             mov dword ptr [ esp + 04h ] , 04h
             mov dword ptr [ esp + 00h ] , 00h
             lea edx ,  dword ptr [ esp + 04h ]
             lea eax ,  dword ptr [ esp + 00h ]
             pushd 0FFFFFFFFh                                                ;0x0046e08f :        6aff
             push edx                                                        ;0x0046e095 :        52
             push eax                                                        ;0x0046e09a :        50
             push 00h                                                        ;0x0046e09b :        55
             pushd 0FFFFFFFFh                                                ;0x0046e09c :        6aff
             pushd 0191h                                                      ;0x0046e09e :        68df000000
             mov  eax , dword ptr [ esp + 24 ][18h][10h]
             push eax                                                        ;0x0046e0a3 :        56
             call Fun433a39                                                  ;0x0046e0a4 :        e89059fcff
             add esp , 01Ch                                                  ;0x0046e0a9 :        83c41c
             mov ecx , dword ptr [ esp + 00h ]
             add esp , 10h
             test eax , eax
             je Label4e5d07
             test ecx , ecx
             je Label4e5d07

             sub esp , 10h
             mov dword ptr [ esp + 04h ] , 04h
             mov dword ptr [ esp + 00h ] , 01h
             lea edx ,  dword ptr [ esp + 04h ]
             lea eax ,  dword ptr [ esp + 00h ]
             pushd 0FFFFFFFFh                                                ;0x0046e08f :        6aff
             push edx                                                        ;0x0046e095 :        52
             push eax                                                        ;0x0046e09a :        50
             push 00h                                                        ;0x0046e09b :        55
             pushd 0FFFFFFFFh                                                ;0x0046e09c :        6aff
             pushd 021h                                                      ;0x0046e09e :        68df000000
             mov  eax , dword ptr [ esp + 24 ][18h][10h]
             push eax                                                        ;0x0046e0a3 :        56
             call Fun433a39                                                  ;0x0046e0a4 :        e89059fcff
             add esp , 01Ch                                                  ;0x0046e0a9 :        83c41c
             mov ecx , dword ptr [ esp + 00h ]
             add esp , 10h
             test eax , eax
             je Label4e5d07
             test ecx , ecx
             jne Label4e5d07

             mov dword ptr vfpa_optionbuttoncaption_isoptionbuttoncaption,01h


     Label4e5d07 ::
             mov eax , edi                                                   ;0x004e5d07 :        8bc7
             push eax                                                        ;0x004e5d09 :        50
             call Fun47d82c                                                  ;0x004e5d0a :        e81d7bf9ff


     ;
     ;                 -------------------------------------------------------------------------------
     ;                      VFP 9.0 FIX - FIX THE OPTIONBUTTON CAPTIONS ARE DISPLAYED WITH SHADOW
     ;                                  August 2021
     ;                 -------------------------------------------------------------------------------
     ;                                     CCB
     ;
     ; If we set the OptionButton.BackStyle property to 0 (Transparent), sometimes the optionbutton captions are displayed with shadow.
     ;
     ; 2021/8/14, by ccb
     ;

     Label4e5d0e ::
             mov dword ptr vfpa_optionbuttoncaption_isoptionbuttoncaption,00h


     Label4e5d0f ::
             mov eax , edi                                                   ;0x004e5d0f :        8bc7
             mov ecx , esi                                                   ;0x004e5d11 :        8bce
             call Fun4e50f8                                                  ;0x004e5d13 :        e8e0f3ffff
             jmp Label4e634d                                                 ;0x004e5d18 :        e930060000

     Now in VFP Advanced, the optionbutton captions are displayed without shadow, it is normal.
     Please refer to the picture testoptionbuttonbackstyle-vfpa.jpg:


4. APPLIES TO:

     VFP 6.0.8167.0
     VFP 6.0.8961.0 (SP5)

     VFP 7.0.0.9262
     VFP 7.0.0.9465 (SP1)

     VFP 8.0.0.2521
     VFP 8.0.0.3117 (SP1)

     VFP 9.0.0.2412
     VFP 9.0.0.3504 (SP1)
     VFP 9.0.0.4611 (SP2)
     VFP 9.0.0.5015 (SP2)
     VFP 9.0.0.5411 (SP2)
     VFP 9.0.0.5721 (SP2)
     VFP 9.0.0.5815 (SP2)
     VFP 9.0.0.6303 (SP2)
     VFP 9.0.0.6602 (SP2)
     VFP 9.0.0.7423 (SP2)

     The bug has been fixed in VFP Advanced.


5. REFERENCE WEBSITES:

     1, baiyujia.com:
     http://www.baiyujia.com
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix190.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix184.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix185.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix188.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix189.asp

     2, microsoft.com:
     https://social.technet.microsoft.com/Forums/windows/en-US/3d60cb6f-4845-4f52-84cb-b57a67fa6029/captions-of-checkbox-labels-and-optionbuttons-gets-darker
     https://devblogs.microsoft.com/oldnewthing/20060614-00/?p=30873

     3, foxite.com:
     https://www.foxite.com/archives/form-labels-get-increasingly-smudged-0000227347.htm
     https://www.foxite.com/archives/bug-with-transparents-labels-0000316393.htm
     https://www.foxite.com/archives/strange-repaintrefresh-with-win10-0000477579.htm

     4, wikis.com:
     https://fox.wikis.com/wc.dll?Wiki~TransparentLabelsBoldedDuringScreenUpdates


6. OTHER:

     For reference only, there is no guarantees.

     Any questions or suggestions, please send me an email at ccb2000@163.com.