亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gaugesex.pas

?? 改進的delphi gauge進度條控件
?? PAS
字號:
unit GaugesEx;

interface

uses SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms, StdCtrls;

type

  TGaugeKind = (gkText, gkHorizontalBar, gkVerticalBar, gkPie, gkNeedle);

  TGaugeEx = class(TGraphicControl)
  private
    FMinValue: Double;
    FMaxValue: Double;
    FCurValue: Double;
    FKind: TGaugeKind;
    FShowText: Boolean;
    FBorderStyle: TBorderStyle;
    FForeColor: TColor;
    FBackColor: TColor;
    procedure PaintBackground(AnImage: TBitmap);
    procedure PaintAsText(AnImage: TBitmap; PaintRect: TRect);
    procedure PaintAsNothing(AnImage: TBitmap; PaintRect: TRect);
    procedure PaintAsBar(AnImage: TBitmap; PaintRect: TRect);
    procedure PaintAsPie(AnImage: TBitmap; PaintRect: TRect);
    procedure PaintAsNeedle(AnImage: TBitmap; PaintRect: TRect);
    procedure SetGaugeKind(Value: TGaugeKind);
    procedure SetShowText(Value: Boolean);
    procedure SetBorderStyle(Value: TBorderStyle);
    procedure SetForeColor(Value: TColor);
    procedure SetBackColor(Value: TColor);
    procedure SetMinValue(Value: Double);
    procedure SetMaxValue(Value: Double);
    procedure SetProgress(Value: Double);
    function GetPercentDone: Longint;
  protected
    procedure Paint; override;
  public
    constructor Create(AOwner: TComponent); override;
    procedure AddProgress(Value: Double);
    property PercentDone: Longint read GetPercentDone;
  published
    property Align;
    property Anchors;
    property BackColor: TColor read FBackColor write SetBackColor default clWhite;
    property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
    property Color;
    property Constraints;
    property Enabled;
    property ForeColor: TColor read FForeColor write SetForeColor default clBlack;
    property Font;
    property Kind: TGaugeKind read FKind write SetGaugeKind default gkHorizontalBar;
    property MinValue: Double read FMinValue write SetMinValue;
    property MaxValue: Double read FMaxValue write SetMaxValue;
    property ParentColor;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property Progress: Double read FCurValue write SetProgress;
    property ShowHint;
    property ShowText: Boolean read FShowText write SetShowText default True;
    property Visible;
  end;

procedure Register;

implementation


uses Consts;

type
  TBltBitmap = class(TBitmap)
    procedure MakeLike(ATemplate: TBitmap);
  end;

procedure Register;
begin
  RegisterComponents('Standard', [TGaugeEx]);
end;

{ TBltBitmap }

procedure TBltBitmap.MakeLike(ATemplate: TBitmap);
begin
  Width := ATemplate.Width;
  Height := ATemplate.Height;
  Canvas.Brush.Color := clWindowFrame;
  Canvas.Brush.Style := bsSolid;
  Canvas.FillRect(Rect(0, 0, Width, Height));
end;

{ This function solves for x in the equation "x is y% of z". }
function SolveForX(Y, Z: Longint): Longint;
begin
  Result := Longint(Trunc( Z * (Y * 0.01) ));
end;

{ This function solves for y in the equation "x is y% of z". }
function SolveForY(X, Z: Double): Longint;
begin
  if Z = 0 then Result := 0
  else Result := Longint(Trunc( (X * 100.0) / Z ));
end;

{ TGauge }

constructor TGaugeEx.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ControlStyle := ControlStyle + [csFramed, csOpaque];
  { default values }
  FMinValue := 0;
  FMaxValue := 100;
  FCurValue := 0;
  FKind := gkHorizontalBar;
  FShowText := True;
  FBorderStyle := bsSingle;
  FForeColor := clBlack;
  FBackColor := clWhite;
  Width := 100;
  Height := 100;
end;

function TGaugeEx.GetPercentDone: Longint;
begin
  Result := SolveForY(FCurValue - FMinValue, FMaxValue - FMinValue);
end;

procedure TGaugeEx.Paint;
var
  TheImage: TBitmap;
  OverlayImage: TBltBitmap;
  PaintRect: TRect;
begin
  with Canvas do
  begin
    TheImage := TBitmap.Create;
    try
      TheImage.Height := Height;
      TheImage.Width := Width;
      PaintBackground(TheImage);
      PaintRect := ClientRect;
      if FBorderStyle = bsSingle then InflateRect(PaintRect, -1, -1);
      OverlayImage := TBltBitmap.Create;
      try
        OverlayImage.MakeLike(TheImage);
        PaintBackground(OverlayImage);
        case FKind of
          gkText: PaintAsNothing(OverlayImage, PaintRect);
          gkHorizontalBar, gkVerticalBar: PaintAsBar(OverlayImage, PaintRect);
          gkPie: PaintAsPie(OverlayImage, PaintRect);
          gkNeedle: PaintAsNeedle(OverlayImage, PaintRect);
        end;
        TheImage.Canvas.CopyMode := cmSrcInvert;
        TheImage.Canvas.Draw(0, 0, OverlayImage);
        TheImage.Canvas.CopyMode := cmSrcCopy;
        if ShowText then PaintAsText(TheImage, PaintRect);
      finally
        OverlayImage.Free;
      end;
      Canvas.CopyMode := cmSrcCopy;
      Canvas.Draw(0, 0, TheImage);
    finally
      TheImage.Destroy;
    end;
  end;
end;

procedure TGaugeEx.PaintBackground(AnImage: TBitmap);
var
  ARect: TRect;
begin
  with AnImage.Canvas do
  begin
    CopyMode := cmBlackness;
    ARect := Rect(0, 0, Width, Height);
    CopyRect(ARect, Animage.Canvas, ARect);
    CopyMode := cmSrcCopy;
  end;
end;

procedure TGaugeEx.PaintAsText(AnImage: TBitmap; PaintRect: TRect);
var
  S: string;
  X, Y: Integer;
  OverRect: TBltBitmap;
begin
  OverRect := TBltBitmap.Create;
  try
    OverRect.MakeLike(AnImage);
    PaintBackground(OverRect);
    S := Format('%d%%', [PercentDone]);
    with OverRect.Canvas do
    begin
      Brush.Style := bsClear;
      Font := Self.Font;
      Font.Color := clWhite;
      with PaintRect do
      begin
        X := (Right - Left + 1 - TextWidth(S)) div 2;
        Y := (Bottom - Top + 1 - TextHeight(S)) div 2;
      end;
      TextRect(PaintRect, X, Y, S);
    end;
    AnImage.Canvas.CopyMode := cmSrcInvert;
    AnImage.Canvas.Draw(0, 0, OverRect);
  finally
    OverRect.Free;
  end;
end;

procedure TGaugeEx.PaintAsNothing(AnImage: TBitmap; PaintRect: TRect);
begin
  with AnImage do
  begin
    Canvas.Brush.Color := BackColor;
    Canvas.FillRect(PaintRect);
  end;
end;

procedure TGaugeEx.PaintAsBar(AnImage: TBitmap; PaintRect: TRect);
var
  FillSize: Longint;
  W, H: Integer;
begin
  W := PaintRect.Right - PaintRect.Left + 1;
  H := PaintRect.Bottom - PaintRect.Top + 1;
  with AnImage.Canvas do
  begin
    Brush.Color := BackColor;
    FillRect(PaintRect);
    Pen.Color := ForeColor;
    Pen.Width := 1;
    Brush.Color := ForeColor;
    case FKind of
      gkHorizontalBar:
        begin
          FillSize := SolveForX(PercentDone, W);
          if FillSize > W then FillSize := W;
          if FillSize > 0 then FillRect(Rect(PaintRect.Left, PaintRect.Top,
            FillSize, H));
        end;
      gkVerticalBar:
        begin
          FillSize := SolveForX(PercentDone, H);
          if FillSize >= H then FillSize := H - 1;
          FillRect(Rect(PaintRect.Left, H - FillSize, W, H));
        end;
    end;
  end;
end;

procedure TGaugeEx.PaintAsPie(AnImage: TBitmap; PaintRect: TRect);
var
  MiddleX, MiddleY: Integer;
  Angle: Double;
  W, H: Integer;
begin
  W := PaintRect.Right - PaintRect.Left;
  H := PaintRect.Bottom - PaintRect.Top;
  if FBorderStyle = bsSingle then
  begin
    Inc(W);
    Inc(H);
  end;
  with AnImage.Canvas do
  begin
    Brush.Color := Color;
    FillRect(PaintRect);
    Brush.Color := BackColor;
    Pen.Color := ForeColor;
    Pen.Width := 1;
    Ellipse(PaintRect.Left, PaintRect.Top, W, H);
    if PercentDone > 0 then
    begin
      Brush.Color := ForeColor;
      MiddleX := W div 2;
      MiddleY := H div 2;
      Angle := (Pi * ((PercentDone / 50) + 0.5));
      Pie(PaintRect.Left, PaintRect.Top, W, H,
        Integer(Round(MiddleX * (1 - Cos(Angle)))),
        Integer(Round(MiddleY * (1 - Sin(Angle)))), MiddleX, 0);
    end;
  end;
end;

procedure TGaugeEx.PaintAsNeedle(AnImage: TBitmap; PaintRect: TRect);
var
  MiddleX: Integer;
  Angle: Double;
  X, Y, W, H: Integer;
begin
  with PaintRect do
  begin
    X := Left;
    Y := Top;
    W := Right - Left;
    H := Bottom - Top;
    if FBorderStyle = bsSingle then
    begin
      Inc(W);
      Inc(H);
    end;
  end;
  with AnImage.Canvas do
  begin
    Brush.Color := Color;
    FillRect(PaintRect);
    Brush.Color := BackColor;
    Pen.Color := ForeColor;
    Pen.Width := 1;
    Pie(X, Y, W, H * 2 - 1, X + W, PaintRect.Bottom - 1, X, PaintRect.Bottom - 1);
    MoveTo(X, PaintRect.Bottom);
    LineTo(X + W, PaintRect.Bottom);
    if PercentDone > 0 then
    begin
      Pen.Color := ForeColor;
      MiddleX := Width div 2;
      MoveTo(MiddleX, PaintRect.Bottom - 1);
      Angle := (Pi * ((PercentDone / 100)));
      LineTo(Integer(Round(MiddleX * (1 - Cos(Angle)))),
        Integer(Round((PaintRect.Bottom - 1) * (1 - Sin(Angle)))));
    end;
  end;
end;

procedure TGaugeEx.SetGaugeKind(Value: TGaugeKind);
begin
  if Value <> FKind then
  begin
    FKind := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetShowText(Value: Boolean);
begin
  if Value <> FShowText then
  begin
    FShowText := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetBorderStyle(Value: TBorderStyle);
begin
  if Value <> FBorderStyle then
  begin
    FBorderStyle := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetForeColor(Value: TColor);
begin
  if Value <> FForeColor then
  begin
    FForeColor := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetBackColor(Value: TColor);
begin
  if Value <> FBackColor then
  begin
    FBackColor := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetMinValue(Value: Double);
begin
  if Value <> FMinValue then
  begin
    if Value > FMaxValue then
      if not (csLoading in ComponentState) then
        raise EInvalidOperation.CreateFmt(SOutOfRange, [-MaxInt, FMaxValue - 1]);
    FMinValue := Value;
    if FCurValue < Value then FCurValue := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetMaxValue(Value: Double);
begin
  if Value <> FMaxValue then
  begin
    if Value < FMinValue then
      if not (csLoading in ComponentState) then
        raise EInvalidOperation.CreateFmt(SOutOfRange, [FMinValue + 1, MaxInt]);
    FMaxValue := Value;
    if FCurValue > Value then FCurValue := Value;
    Refresh;
  end;
end;

procedure TGaugeEx.SetProgress(Value: Double);
var
  TempPercent: Longint;
begin
  TempPercent := GetPercentDone;  { remember where we were }
  if Value < FMinValue then
    Value := FMinValue
  else if Value > FMaxValue then
    Value := FMaxValue;
  if FCurValue <> Value then
  begin
    FCurValue := Value;
    if TempPercent <> GetPercentDone then { only refresh if percentage changed }
      Refresh;
  end;
end;

procedure TGaugeEx.AddProgress(Value: Double);
begin
  Progress := FCurValue + Value;
  Refresh;
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图都市小说| 欧美成人艳星乳罩| 一区二区国产视频| 欧美在线观看你懂的| 午夜欧美一区二区三区在线播放| 色久综合一二码| 婷婷综合久久一区二区三区| 91 com成人网| 国产黄色91视频| 亚洲色欲色欲www| 欧美精品自拍偷拍动漫精品| 蜜臀av性久久久久蜜臀aⅴ流畅| 2024国产精品| 91美女在线观看| 日韩国产欧美一区二区三区| 日韩一区二区三区免费看| 国产激情一区二区三区| 一个色在线综合| 精品少妇一区二区| 91免费版在线| 麻豆久久久久久| 亚洲乱码国产乱码精品精的特点 | 国产精品色在线| 欧美日韩一区二区不卡| 国产一区二区精品在线观看| 综合激情成人伊人| 日韩美女天天操| 91蝌蚪porny九色| 久久不见久久见免费视频7 | 2024国产精品| 色诱亚洲精品久久久久久| 蜜臀99久久精品久久久久久软件| 国产精品美女www爽爽爽| 日韩一区二区在线看| av成人老司机| 久久国产精品第一页| 亚洲精品国产品国语在线app| 欧美tickle裸体挠脚心vk| 欧洲精品一区二区| 成人午夜碰碰视频| 蜜桃精品在线观看| 一区二区三区在线视频观看58| 精品卡一卡二卡三卡四在线| 欧美在线免费观看视频| 成人爱爱电影网址| 国产九九视频一区二区三区| 日韩中文字幕亚洲一区二区va在线 | 精品一区二区三区免费观看| 亚洲美女精品一区| 国产欧美一区二区三区网站| 欧美一级片在线观看| 欧美在线|欧美| 93久久精品日日躁夜夜躁欧美| 国产中文一区二区三区| 蜜桃av一区二区三区电影| 亚洲成人免费视| 一区二区欧美国产| 亚洲天堂av一区| 国产精品大尺度| 欧美高清在线视频| 国产欧美久久久精品影院| 精品国产一区二区在线观看| 欧美精品亚洲一区二区在线播放| 色综合久久综合网97色综合| 99久久精品国产导航| 成人av午夜影院| 成人免费观看av| 粉嫩aⅴ一区二区三区四区五区 | 亚洲成人免费在线观看| 一卡二卡三卡日韩欧美| 一卡二卡欧美日韩| 一区二区三区精品在线| 亚洲精品成人天堂一二三| 一区二区三区色| 亚洲在线视频免费观看| 亚洲一区二区三区四区五区中文| 亚洲精品videosex极品| 一区二区三区日本| 亚洲最新视频在线播放| 亚洲国产精品久久不卡毛片| 亚洲第一狼人社区| 日本va欧美va瓶| 另类小说视频一区二区| 日本不卡免费在线视频| 精品一区二区三区欧美| 国产成人综合亚洲91猫咪| 国产99久久久国产精品| 91色porny| 欧美日韩国产综合一区二区三区| 91精品婷婷国产综合久久性色| 日韩欧美一二区| 久久亚洲免费视频| 国产精品视频在线看| 亚洲欧美日韩精品久久久久| 亚洲国产精品久久久久婷婷884| 香蕉影视欧美成人| 国产美女一区二区| 一本久道久久综合中文字幕| 欧美性一级生活| 日韩视频免费观看高清完整版在线观看 | 国产精品乱人伦一区二区| 亚洲欧洲成人精品av97| 亚洲午夜免费电影| 蜜桃精品视频在线观看| 成人一区二区在线观看| 欧美熟乱第一页| 欧美va亚洲va| 国产精品久99| 亚洲成人一区在线| 国产精品911| 欧美精品第一页| 欧美激情中文不卡| 日精品一区二区| 成人午夜电影小说| 7799精品视频| 国产精品丝袜黑色高跟| 蜜桃av噜噜一区| 日本精品免费观看高清观看| 精品国产精品网麻豆系列| 亚洲精品亚洲人成人网| 久久99精品久久久久久动态图| 91在线视频免费91| 欧美电视剧在线看免费| 亚洲欧美日韩精品久久久久| 激情综合色综合久久综合| 欧美亚洲国产怡红院影院| 国产色综合一区| 午夜av一区二区三区| 99久久精品费精品国产一区二区| 日韩美女视频一区二区在线观看| 亚洲人成电影网站色mp4| 精品制服美女丁香| 在线亚洲一区二区| 国产欧美一区二区精品久导航 | 国产91在线观看丝袜| 精品1区2区3区| 久久精品视频一区二区三区| 亚洲午夜私人影院| 99久久精品国产一区二区三区| 日韩亚洲欧美在线| 午夜伦欧美伦电影理论片| 91在线观看下载| 久久精品人人爽人人爽| 久久精品国产秦先生| 91激情五月电影| 中文字幕制服丝袜一区二区三区 | 亚洲成a人片综合在线| 99精品视频免费在线观看| 久久影院午夜论| 免费观看日韩电影| 51精品国自产在线| 亚洲午夜私人影院| 欧美中文字幕一区| 亚洲最快最全在线视频| 色哟哟一区二区| 亚洲蜜桃精久久久久久久| 粉嫩13p一区二区三区| 国产人成亚洲第一网站在线播放 | 亚洲天堂精品视频| 国产一区二区中文字幕| 欧美精品 国产精品| 亚洲一区二区成人在线观看| 欧美在线看片a免费观看| 亚洲欧美日韩电影| 91精品办公室少妇高潮对白| 自拍偷拍亚洲综合| 91视频在线观看| 综合久久久久久久| 色婷婷综合五月| 自拍视频在线观看一区二区| 不卡区在线中文字幕| 中文字幕在线观看一区二区| a亚洲天堂av| 中文字幕一区二区三区在线观看| 粉嫩蜜臀av国产精品网站| 国产精品看片你懂得| 色香蕉久久蜜桃| 亚洲国产综合人成综合网站| 欧美色视频一区| 日韩精品国产精品| 欧美videofree性高清杂交| 免费观看91视频大全| 日韩美女视频在线| 国产91丝袜在线播放九色| 中文字幕成人av| 欧亚一区二区三区| 日本一区中文字幕| 久久久亚洲综合| 99re热视频精品| 亚洲自拍偷拍麻豆| 欧美一区二区三区啪啪| 国内精品在线播放| 国产精品乱人伦中文| 欧美三级日韩在线| 日韩av中文在线观看| 久久亚洲捆绑美女| 91老师片黄在线观看| 日日夜夜精品免费视频| 国产色一区二区| 欧美特级限制片免费在线观看|