用到 myfunctions 的几个函数(大部分是绘图函数),代码如下,当然你可以用你的绘图函数代替它们-----------function percentToFloat(value: string): double;用料排序的var i: integer; s: string;begin s:=value; while Pos('%', S) > 0 do S[Pos('%', S)] := #0; result:=StrToFloat(s);end;procedure BlendBmp(bmp: TBitmap; clBlend: Tcolor; value: byte);半透明图片var Pixel: PRGBTriple; w, h: Integer; x, y: Integer; clR,clG,clB: TColor;begin Bmp.PixelFormat := pf24Bit; w := bmp.Width; h := bmp.Height; clR:=getRValue(clBlend); clG:=getGValue(clBlend); clB:=getBValue(clBlend); for y := 0 to h - 1 do begin Pixel := bmp.ScanLine[y]; for x := 0 to w - 1 do begin pixel^.rgbtRed:=(pixel^.rgbtRed*(255-value)+clR * value) div 255; pixel^.rgbtGreen:=(pixel^.rgbtGreen*(255-value)+clG * value) div 255; pixel^.rgbtBlue:=(pixel^.rgbtBlue*(255-value)+clB * value) div 255; Inc(Pixel); end; end;end;procedure FillTubeGradientRect(DC: HDC; const ARect: TRect; AColor1, AColor2: TColor; AHorizontal: Boolean);var FromR, FromG, FromB, ToR, ToG, ToB: Integer; ToR1, ToG1, ToB1, ToR2, ToG2, ToB2: Integer; SR: TRect; W, I, N, M: Integer; R, G, B: Byte; ABrush: HBRUSH; ALeft, ARight, ARectLeft, ARectRight: ^Integer;begin AColor1 := ColorToRGB(AColor1); AColor2 := ColorToRGB(AColor2); if AColor1 = AColor2 then begin ABrush := CreateSolidBrush(AColor1); FillRect(DC, ARect, ABrush); DeleteObject(ABrush); Exit; end; FromR := GetRValue(AColor1); FromG := GetGValue(AColor1); FromB := GetBValue(AColor1); ToR := GetRValue(AColor2); ToG := GetGValue(AColor2); ToB := GetBValue(AColor2); SR := ARect; if AHorizontal then begin ALeft := @SR.Left; ARight := @SR.Right; ARectLeft := @ARect.Left; ARectRight := @ARect.Right; end else begin ALeft := @SR.Top; ARight := @SR.Bottom; ARectLeft := @ARect.Top; ARectRight := @ARect.Bottom; end; W := ARight^ - ALeft^; M := W div 2; ToR1 := FromR - MulDiv(FromR - ToR, 80, 200); ToG1 := FromG - MulDiv(FromG - ToG, 80, 200); ToB1 := FromB - MulDiv(FromB - ToB, 80, 200); ToR2 := FromR - MulDiv(FromR - ToR1, W, M); ToG2 := FromG - MulDiv(FromG - ToG1, W, M); ToB2 := FromB - MulDiv(FromB - ToB1, W, M); N := 256; if W < N then N := W; for I := 0 to N - 1 do begin ARight^ := ARectLeft^ + MulDiv(I + 1, W, N); if I < M then begin R := FromR + MulDiv(I, ToR2 - FromR, N - 1); G := FromG + MulDiv(I, ToG2 - FromG, N - 1); B := FromB + MulDiv(I, ToB2 - FromB, N - 1); end else if I = M then begin R := ToR1; G := ToG1; B := ToB1; FromR := ToR + MulDiv(ToR1 - ToR, W, M); FromG := ToG + MulDiv(ToG1 - ToG, W, M); FromB := ToB + MulDiv(ToB1 - ToB, W, M); end else begin R := FromR + MulDiv(I, ToR - FromR, N - 1); G := FromG + MulDiv(I, ToG - FromG, N - 1); B := FromB + MulDiv(I, ToB - FromB, N - 1); end; if not IsRectEmpty(SR) then begin ABrush := CreateSolidBrush(RGB(R, G, B)); FillRect(DC, SR, ABrush); DeleteObject(ABrush); end; ALeft^ := ARight^; if ALeft^ >= ARectRight^ then Break; end;end;procedure DrawUpArraw(ACanvas: TCanvas;ARect: TRect; Size: byte; Color: Tcolor);var oldBsColor: TColor; PL, PR, PT: Tpoint; Rw, Rh: integer;begin oldBsColor:=ACanvas.Brush.Color; Rw:=ARect.Right-Arect.Left; Rh:=ARect.Bottom-ARect.Top; PT:=point(ARect.Left + Rw div 2, ARect.Top+(Rh-size) div 2); PL:=point(ARect.Left + Rw div 2 - Size, ARect.Top+(Rh+size) div 2); PR:=point(ARect.Left + Rw div 2 + Size, ARect.Top+(Rh+size) div 2); with ACanvas do begin pen.Color:=color; Brush.Color:=color; Polygon([PL,PR,PT]); Brush.Color:=OldBsColor; end;end;procedure DrawDownArraw(ACanvas: TCanvas;ARect: TRect; Size: byte; Color: Tcolor);var oldBsColor: TColor; PL, PR, PB: Tpoint; Rw, Rh: integer;begin oldBsColor:=ACanvas.Brush.Color; Rw:=ARect.Right-Arect.Left; Rh:=ARect.Bottom-ARect.Top; PL:=point(ARect.Left + Rw div 2 - Size, ARect.Top+(Rh-size) div 2); PR:=point(ARect.Left + Rw div 2 + Size, ARect.Top+(Rh-size) div 2); PB:=point(ARect.Left + Rw div 2, ARect.Top+(Rh-size) div 2 + Size); with ACanvas do begin pen.Color:=color; Brush.Color:=color; Polygon([PL,PR,PB]); Brush.Color:=OldBsColor; end;end;//混合颜色function getAlphaColor(BackColor,ForeColor: TColor; alpha: integer): TColor; var R,G,B: integer;begin backColor:=TColor(backColor); backColor:=colortoRGB(backColor); ForeColor:=colortoRGB(ForeColor); R:=(getRValue(backColor)*(255-alpha)+getRvalue(ForeColor)*alpha) div 255; G:=(getGValue(backColor)*(255-alpha)+getGvalue(ForeColor)*alpha) div 255; B:=(getBValue(backColor)*(255-alpha)+getBvalue(ForeColor)*alpha) div 255; if R>255 then R:=255; if R<0 then R:=0; if G>255 then G:=255; if G<0 then R:=0; if B>255 then B:=255; if B<0 then B:=0; result:=RGB(R,G,B);end;有需要的可以Email 给我,或者在我的博客留言