如果是经典的界面,下面修改下,才可以看出效果 procedure DrawSetProgress; type TRGB = record res, B, G, R: Byte; end; const RED_VAL = 128; //红色分量 RED_ALPHA = 50; //混合比 var DC: HDC; x, y: integer; clr: TColor; begin InflateRect(BtnRect, -1, -4); DC := GetWindowDC(TrayWnd); Canvas.Handle := DC; for x := BtnRect.Left to BtnRect.Left + ((BtnRect.Right - BtnRect.Left) * Percent div 100) do for y := BtnRect.Top to BtnRect.Bottom do with TRGB(Canvas.Pixels[x, y]) do //if (B in [$4B..$5D]) and (G in [$B6..$BC]) then Canvas.Pixels[x, y] := RGB(Trunc(R*RED_ALPHA/255+RED_VAL*(255-RED_ALPHA)/255), G, B); ReleaseDC(TrayWnd, DC); end; |