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



1. BUG:

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

     The bug only occurs when the Label.BackStyle property is 0 (Transparent), it does not occur when the Label.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 the Label.Anchor property is 0 (Top Left) or the Label.Anchor property includes the following flags:
     1 (Top Absolute), 2 (Left Absolute), 16 (Top Relative), 32 (Left Relative).

     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 label captions are displayed with shadow, please refer to the picture testlabelbackstyle-vfp9.jpg:


2. CAUSE:

     There are some BUGs in the following code.


3. RESOLUTION:

     We can write some code to fix the BUG.

     Label4d7481 ::
             push edi                                                        ;0x004d7481 :        57

     Label4d7482 ::
             mov  ebx , dword ptr [ Data9388dc ]                             ;0x004d7482 :        8b1ddc889300
             mov  edx , dword ptr [ esp + 080h ]                             ;0x004d7488 :        8b942480000000
             lea edi ,  dword ptr [ esi + 4 * esi ]                          ;0x004d748f :        8d3cb6
             shl edi , 05h                                                   ;0x004d7492 :        c1e705
             cmp  dword ptr [ edi + ebx + 24 ] , edx                         ;0x004d7495 :        39541f18
             mov  dword ptr [ esp + 16 ] , edi                               ;0x004d7499 :        897c2410
             jne Label4cce31                                                 ;0x004d749d :        0f858e59ffff
             lea eax ,  dword ptr [ esp + 084h ]                             ;0x004d74a3 :        8d842484000000
             push eax                                                        ;0x004d74aa :        50
             pushd 02E8h                                                     ;0x004d74ab :        68e8020000
             mov eax , esi                                                   ;0x004d74b0 :        8bc6
             call Fun433401                                                  ;0x004d74b2 :        e84abff5ff
             cmp eax , 0FFFFFFFFh                                            ;0x004d74b7 :        83f8ff
             jle Label4cce31                                                 ;0x004d74ba :        0f8e7159ffff
             mov  edx , dword ptr [ esp + 084h ]                             ;0x004d74c0 :        8b942484000000
             lea ecx ,  dword ptr [ eax + 4 * eax ]                          ;0x004d74c7 :        8d0c80
             mov  eax , dword ptr [edx]                                      ;0x004d74ca :        8b02
             mov  ecx , dword ptr [ eax + 8 * ecx + 20 ]                     ;0x004d74cc :        8b4cc814
             shr ecx , 0Eh                                                   ;0x004d74d0 :        c1e90e
             not ecx                                                         ;0x004d74d3 :        f7d1
             and ecx , 01h                                                   ;0x004d74d5 :        83e101
             mov  dword ptr [ esp + 100 ] , ecx                              ;0x004d74d8 :        894c2464
             je Label4cce31                                                  ;0x004d74dc :        0f844f59ffff
             pushd 0FFFFFFFFh                                                ;0x004d74e2 :        6aff
             lea edx ,  dword ptr [ esp + 104 ]                              ;0x004d74e4 :        8d542468
             push edx                                                        ;0x004d74e8 :        52
             lea eax ,  dword ptr [ esp + 28 ]                               ;0x004d74e9 :        8d44241c
             push eax                                                        ;0x004d74ed :        50
             push ebp                                                        ;0x004d74ee :        55
             pushd 0FFFFFFFFh                                                ;0x004d74ef :        6aff
             pushd 02E7h                                                     ;0x004d74f1 :        68e7020000
             mov ebx , 04h                                                   ;0x004d74f6 :        bb04000000
             push esi                                                        ;0x004d74fb :        56
             mov  dword ptr [ esp + 080h ] , ebx                             ;0x004d74fc :        899c2480000000
             mov  dword ptr [ esp + 48 ] , ebp                               ;0x004d7503 :        896c2430
             call Fun433a39                                                  ;0x004d7507 :        e82dc5f5ff
             add esp , 01Ch                                                  ;0x004d750c :        83c41c
             test eax , eax                                                  ;0x004d750f :        85c0
             je Label4d751d                                                  ;0x004d7511 :        740a
             cmp  dword ptr [ esp + 20 ] , ebp                               ;0x004d7513 :        396c2414
             jne Label46e007                                                 ;0x004d7517 :        0f85ea6af9ff


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

             cmp dword ptr vfpa_sys9064_data,00h
             je Label46e2d8

             mov  ecx , dword ptr [ Data9388dc ]
             lea eax ,  dword ptr [ esi + 4 * esi ]
             shl eax , 05h
             cmp  word ptr [ eax + ecx + 16 ] , 0340h
             je Label4d751c
             cmp  word ptr [ eax + ecx + 16 ] , 0334h
             je Label4d751c
             cmp  word ptr [ eax + ecx + 16 ] , 0335h
             je Label4d751c
             jmp Label46e2d8

     Label4d751c ::
             push edi
             mov edi , esi
             call vfpa_getformvisible
             pop edi
             cmp eax , 00h
             jle Label46e2d8

             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
             push esi                                                        ;0x0046e0a3 :        56
             call Fun433a39                                                  ;0x0046e0a4 :        e89059fcff
             add esp , 01Ch                                                  ;0x0046e0a9 :        83c41c
             mov ecx , dword ptr [ esp + 00h ]
             add esp , 10h
             test eax , eax
             je Label46e2d8
             test ecx , ecx
             je Label46e2d8

             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
             push esi                                                        ;0x0046e0a3 :        56
             call Fun433a39                                                  ;0x0046e0a4 :        e89059fcff
             add esp , 01Ch                                                  ;0x0046e0a9 :        83c41c
             mov ecx , dword ptr [ esp + 00h ]
             add esp , 10h
             test eax , eax
             je Label46e2d8
             test ecx , ecx
             jne Label46e2d8

             mov dword ptr [ esp + 28 ] , 04h

             pushd 0FFFFFFFFh                                                ;0x0046e08f :        6aff
             lea edx ,  dword ptr [ esp + 32 ]                               ;0x0046e091 :        8d542420
             push edx                                                        ;0x0046e095 :        52
             lea eax ,  dword ptr [ esp + 116 ]                              ;0x0046e096 :        8d442474
             push eax                                                        ;0x0046e09a :        50
             push ebp                                                        ;0x0046e09b :        55
             pushd 0FFFFFFFFh                                                ;0x0046e09c :        6aff
             pushd 0DFh                                                      ;0x0046e09e :        68df000000
             push esi                                                        ;0x0046e0a3 :        56
             call Fun433a39                                                  ;0x0046e0a4 :        e89059fcff
             add esp , 01Ch                                                  ;0x0046e0a9 :        83c41c

             pushd 0FFFFFFFFh                                                ;0x0046e0be :        6aff
             lea ecx ,  dword ptr [ esp + 32 ]                               ;0x0046e0c0 :        8d4c2420
             push ecx                                                        ;0x0046e0c4 :        51
             lea edx ,  dword ptr [ esp + 100 ]                              ;0x0046e0c5 :        8d542464
             push edx                                                        ;0x0046e0c9 :        52
             push ebp                                                        ;0x0046e0ca :        55
             pushd 0FFFFFFFFh                                                ;0x0046e0cb :        6aff
             pushd 0184h                                                     ;0x0046e0cd :        6884010000
             push esi                                                        ;0x0046e0d2 :        56
             call Fun433a39                                                  ;0x0046e0d3 :        e86159fcff
             add esp , 01Ch                                                  ;0x0046e0d8 :        83c41c

             pushd 0FFFFFFFFh                                                ;0x0046e0ed :        6aff
             lea eax ,  dword ptr [ esp + 32 ]                               ;0x0046e0ef :        8d442420
             push eax                                                        ;0x0046e0f3 :        50
             lea ecx ,  dword ptr [ esp + 64 ]                               ;0x0046e0f4 :        8d4c2440
             push ecx                                                        ;0x0046e0f8 :        51
             push ebp                                                        ;0x0046e0f9 :        55
             pushd 0FFFFFFFFh                                                ;0x0046e0fa :        6aff
             pushd 0196h                                                     ;0x0046e0fc :        6896010000
             push esi                                                        ;0x0046e101 :        56
             call Fun433a39                                                  ;0x0046e102 :        e83259fcff
             add esp , 01Ch                                                  ;0x0046e107 :        83c41c

             pushd 0FFFFFFFFh                                                ;0x0046e11c :        6aff
             lea edx ,  dword ptr [ esp + 32 ]                               ;0x0046e11e :        8d542420
             push edx                                                        ;0x0046e122 :        52
             lea eax ,  dword ptr [ esp + 40 ]                               ;0x0046e123 :        8d442428
             push eax                                                        ;0x0046e127 :        50
             push ebp                                                        ;0x0046e128 :        55
             pushd 0FFFFFFFFh                                                ;0x0046e129 :        6aff
             pushd 0C4h                                                      ;0x0046e12b :        68c4000000
             push esi                                                        ;0x0046e130 :        56
             call Fun433a39                                                  ;0x0046e131 :        e80359fcff
             add esp , 01Ch                                                  ;0x0046e136 :        83c41c

             mov  dword ptr [ esp + 24 ] , esi

             mov dword ptr vfpa_movemethod_inmovemethod,01h
             mov  edx , dword ptr [ esp + 24 ]
             mov  ebp , dword ptr [ esp + 108 ]
             mov  ebx , dword ptr [ esp + 92 ]
             mov  edi , dword ptr [ esp + 56 ]
             mov  esi , dword ptr [ esp + 32 ]
             push esi                                                        ;0x0046e300 :        56
             pushd 049h                                                      ;0x0046e301 :        6a49
             push edi                                                        ;0x0046e305 :        57
             pushd 049h                                                      ;0x0046e306 :        6a49
             push ebx                                                        ;0x0046e308 :        53
             pushd 049h                                                      ;0x0046e309 :        6a49
             push ebp                                                        ;0x0046e30b :        55
             pushd 049h                                                      ;0x0046e30c :        6a49
             pushd 04h                                                       ;0x0046e30e :        6a04
             pushd 0107h                                                     ;0x0046e310 :        6807010000
             push edx                                                        ;0x0046e315 :        52
             call Fun4f088f                                                  ;0x0046e316 :        e874250800
             add esp , 02Ch                                                  ;0x0046e31b :        83c42c
             mov dword ptr vfpa_movemethod_inmovemethod,00h
             jmp Label46e2d8


     Label4d751d ::
             pushd 01h                                                       ;0x004d751d :        6a01
             mov ebx , 0Ah                                                   ;0x004d751f :        bb0a000000
             lea eax ,  dword ptr [ esp + 08Ch ]                             ;0x004d7524 :        8d84248c000000
             call Fun436eea                                                  ;0x004d752b :        e8baf9f5ff
             mov esi , eax                                                   ;0x004d7530 :        8bf0
             cmp esi , ebp                                                   ;0x004d7532 :        3bf5
             mov  dword ptr [ esp + 24 ] , esi                               ;0x004d7534 :        89742418
             jne Label4d7482                                                 ;0x004d7538 :        0f8544ffffff
             pop edi                                                         ;0x004d753e :        5f
             jmp Label428f4d                                                 ;0x004d753f :        e9091af5ff

     Now in VFP Advanced, the label captions are displayed without shadow, it is normal.
     Please refer to the picture testlabelbackstyle-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_vfp9fix184.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix188.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix189.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix190.asp
     http://www.baiyujia.com/vfpdocuments/f_vfp9fix191.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.