From: Warren P. <wp...@us...> - 2005-03-07 16:45:42
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12299/run Modified Files: JvXPBar.pas Log Message: Transparency issue fix for WinXPSP2 and WindowsServer2003. (Other versions of Windows, including WinXP and XP SP1 do not have the transparency bug which this patch is a workaround for). The patch is implemented only if XP_TRANSPARENCY_FIX is defined, which for now, it is defined statically in the code, you can comment out that line to try the code with and without the patch. The patch may be removed later if all current shipping Windows versions are unaffected by this bug. Index: JvXPBar.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvXPBar.pas,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** JvXPBar.pas 17 Feb 2005 10:21:17 -0000 1.87 --- JvXPBar.pas 7 Mar 2005 16:45:17 -0000 1.88 *************** *** 53,56 **** --- 53,66 ---- {$ENDIF !USEJVCL} + // XP_TRANSPARENCY_FIX: + // WinXPSP2/WinServer2003 transparency workaround: + // Define to add calls to BitmapBgPaint to pre-paint + // bitmap using XPBar.Colors.BodyColor, to fix + // transparency issues. Note that this is a real + // bug in Windows XP and 2003 and once all machines + // "OUT THERE" have been updated, this should be removed + // from the code. + {$define XP_TRANSPARENCY_FIX} + interface *************** *** 638,641 **** --- 648,677 ---- end; + {$ifdef XP_TRANSPARENCY_FIX} + { BitmapBgPaint: + + This fixes a bug in the Delphi 7 VCL on systems + running Windows XP SP2 or Windows Server 2003, + where transparency in the VCL TImageList.Draw + function is broken. + + -WPostma. } + + procedure BitmapBgPaint( Bitmap:TBitmap;bgColor:TColor); + var + r:TRect; + begin + r.Left := 0; + r.Top := 0; + r.Right := Bitmap.Width; + r.Bottom := Bitmap.Height; + Bitmap.Canvas.Brush.Color := bgColor; + Bitmap.Canvas.FillRect( r ); + end; + + {$endif} + + + //=== { TJvXPBarItemActionLink } ============================================= *************** *** 2032,2037 **** ItemRect := GetItemRect(Index); HasImages := FVisibleItems[Index].Images <> nil; ! if HasImages then FVisibleItems[Index].Images.GetBitmap(FVisibleItems[Index].ImageIndex, Bitmap); Bitmap.Transparent := True; if OwnerDraw then --- 2068,2077 ---- ItemRect := GetItemRect(Index); HasImages := FVisibleItems[Index].Images <> nil; ! if HasImages then begin ! {$ifdef XP_TRANSPARENCY_FIX} ! BitmapBgPaint( Bitmap, {WinXPBar.}Colors.BodyColor); ! {$endif} FVisibleItems[Index].Images.GetBitmap(FVisibleItems[Index].ImageIndex, Bitmap); + end; Bitmap.Transparent := True; if OwnerDraw then *************** *** 2163,2166 **** --- 2203,2209 ---- end; Bitmap.Transparent := True; + {$ifdef XP_TRANSPARENCY_FIX} + BitmapBgPaint( Bitmap, {WinXPBar.}Colors.BodyColor); + {$endif} ACanvas.Draw(R.Right - 24, R.Top + (HeaderHeight - GetRollHeight) div 2, Bitmap); finally |