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

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

?? gauges.pas

?? 2003年的遠程控制
?? PAS
字號:
unit Gauges;

interface

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

type

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

  TGauge = class(TGraphicControl)
  private
    FMinValue: Longint;
    FMaxValue: Longint;
    FCurValue: Longint;
    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: Longint);
    procedure SetMaxValue(Value: Longint);
    procedure SetProgress(Value: Longint);
    function GetPercentDone: Longint;
  protected
    procedure Paint; override;
  public
    constructor Create(AOwner: TComponent); override;
    procedure AddProgress(Value: Longint);
    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: Longint read FMinValue write SetMinValue default 0;
    property MaxValue: Longint read FMaxValue write SetMaxValue default 100;
    property ParentColor;
    property ParentFont;
    property ParentShowHint;
    property PopupMenu;
    property Progress: Longint read FCurValue write SetProgress;
    property ShowHint;
    property ShowText: Boolean read FShowText write SetShowText default True;
    property Visible;
  end;

implementation

uses Consts;

type
  TBltBitmap = class(TBitmap)
    procedure MakeLike(ATemplate: TBitmap);
  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: Longint): Longint;
begin
  if Z = 0 then Result := 0
  else Result := Longint(Trunc( (X * 100.0) / Z ));
end;

{ TGauge }

constructor TGauge.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 TGauge.GetPercentDone: Longint;
begin
  Result := SolveForY(FCurValue - FMinValue, FMaxValue - FMinValue);
end;

procedure TGauge.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 TGauge.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 TGauge.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 TGauge.PaintAsNothing(AnImage: TBitmap; PaintRect: TRect);
begin
  with AnImage do
  begin
    Canvas.Brush.Color := BackColor;
    Canvas.FillRect(PaintRect);
  end;
end;

procedure TGauge.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 TGauge.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 TGauge.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 TGauge.SetGaugeKind(Value: TGaugeKind);
begin
  if Value <> FKind then
  begin
    FKind := Value;
    Refresh;
  end;
end;

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

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

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

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

procedure TGauge.SetMinValue(Value: Longint);
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 TGauge.SetMaxValue(Value: Longint);
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 TGauge.SetProgress(Value: Longint);
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 TGauge.AddProgress(Value: Longint);
begin
  Progress := FCurValue + Value;
  Refresh;
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线观看三级视频欧美| 国产午夜亚洲精品理论片色戒 | 欧美高清hd18日本| 精品国产a毛片| 亚洲一区二区五区| 成人av第一页| 久久亚洲精精品中文字幕早川悠里 | 久久精品视频在线免费观看| 亚洲一区二区三区四区的| 国产成人av资源| 日韩欧美一区二区三区在线| 亚洲欧美另类小说| 国产盗摄视频一区二区三区| 日韩午夜在线影院| 午夜亚洲国产au精品一区二区| 国产 日韩 欧美大片| 日韩免费一区二区三区在线播放| 亚洲伊人伊色伊影伊综合网| 成人免费福利片| 国产日本一区二区| 精品一区二区三区的国产在线播放 | 国产成人午夜精品影院观看视频| 91精品国产高清一区二区三区蜜臀 | 欧美国产日韩一二三区| 久久成人免费日本黄色| 欧美一区二区视频在线观看 | 免费观看91视频大全| 欧美日韩一区二区三区四区五区| 亚洲色图一区二区三区| 成人av在线看| 国产精品你懂的在线| 国产成人h网站| 中文字幕成人av| 99精品1区2区| 亚洲欧美日韩精品久久久久| 99视频在线精品| 一区二区三区av电影| 日本黄色一区二区| 亚洲va欧美va人人爽| 中文字幕第一区二区| av不卡免费在线观看| 亚洲精品ww久久久久久p站| 99精品久久久久久| 亚洲一区二区欧美| 51精品秘密在线观看| 久久99国内精品| 欧美韩国一区二区| 一本色道a无线码一区v| 亚洲成av人片一区二区梦乃| 9191久久久久久久久久久| 日韩 欧美一区二区三区| 精品国产一区二区三区av性色| 黄色日韩三级电影| 国产欧美综合色| 日本久久电影网| 秋霞午夜鲁丝一区二区老狼| 国产亚洲综合性久久久影院| 99视频一区二区三区| 亚洲国产人成综合网站| 欧美变态tickle挠乳网站| 成人小视频在线观看| 亚洲综合自拍偷拍| 精品免费国产一区二区三区四区| 粉嫩aⅴ一区二区三区四区五区 | 精品国产乱码久久久久久浪潮| 国产福利91精品一区| 夜夜揉揉日日人人青青一国产精品| 6080亚洲精品一区二区| 国产精品夜夜爽| 亚洲高清在线精品| 日本一区二区三区高清不卡 | 久久嫩草精品久久久久| 99国产精品久久久久久久久久| 亚洲成人av中文| 欧美国产欧美亚州国产日韩mv天天看完整| 91免费在线视频观看| 日韩成人av影视| 亚洲精品视频在线看| 日韩精品一区国产麻豆| 91传媒视频在线播放| 国产精品中文欧美| 日韩高清不卡一区| 国产精品传媒入口麻豆| 91精品婷婷国产综合久久| 99久久久无码国产精品| 激情丁香综合五月| 人人爽香蕉精品| 亚洲美女偷拍久久| 日本一区二区电影| 精品奇米国产一区二区三区| 精品污污网站免费看| 成人免费高清视频在线观看| 黄色资源网久久资源365| 亚洲福利一区二区| 亚洲精品视频一区| 美女一区二区三区| 亚洲成年人影院| 一区二区三区欧美| 亚洲欧美日韩在线| 最新国产精品久久精品| 久久久蜜臀国产一区二区| 欧美一区二区三区在| 欧美私人免费视频| 91久久一区二区| 一本到一区二区三区| 99久久精品国产导航| aaa国产一区| 成人免费视频国产在线观看| 国内成人自拍视频| 国产乱国产乱300精品| 久久不见久久见免费视频7| 青青草国产成人99久久| 日韩二区三区在线观看| 日韩国产精品大片| 另类小说色综合网站| 美女网站色91| 激情伊人五月天久久综合| 强制捆绑调教一区二区| 欧美aaaaa成人免费观看视频| 天堂资源在线中文精品| 亚洲成人一区在线| 奇米精品一区二区三区在线观看一 | 亚洲欧洲另类国产综合| 综合激情网...| 一区二区三区国产| 天堂午夜影视日韩欧美一区二区| 日韩和欧美一区二区三区| 日韩av中文字幕一区二区| 精品在线视频一区| 国产不卡视频在线观看| 99精品桃花视频在线观看| 欧美在线观看视频一区二区| 制服.丝袜.亚洲.中文.综合| 欧美一级片免费看| 久久久91精品国产一区二区精品 | 精品三级在线观看| 国产精品天干天干在线综合| 亚洲男人电影天堂| 日韩精品一级二级 | 色一情一伦一子一伦一区| 91国产精品成人| 日韩视频中午一区| 亚洲国产精品成人综合色在线婷婷 | 久久欧美一区二区| 亚洲少妇中出一区| 日日骚欧美日韩| 国产风韵犹存在线视精品| 日本精品一区二区三区四区的功能| 欧美欧美午夜aⅴ在线观看| 久久久久久久久久美女| 亚洲色图.com| 久久国产精品无码网站| www.欧美色图| 91精品国产欧美一区二区18| 久久精品夜色噜噜亚洲aⅴ| 一区二区久久久久| 国产精品资源在线看| 欧美色欧美亚洲另类二区| 欧美精品一区二区三区高清aⅴ| 成人欧美一区二区三区在线播放| 色婷婷亚洲婷婷| 国产午夜精品一区二区| 性感美女久久精品| a亚洲天堂av| 精品国产一二三区| 亚洲综合色在线| 国产福利一区二区| 欧美一二三在线| 亚洲夂夂婷婷色拍ww47| 国产高清在线精品| 欧美一区二区三区四区高清| 日韩码欧中文字| 国产一区二区三区免费在线观看| 欧美日韩精品一区二区天天拍小说| 欧美韩国日本一区| 国产精品综合av一区二区国产馆| 欧美性xxxxx极品少妇| 中文字幕av资源一区| 国产在线精品一区二区三区不卡| 欧美群妇大交群中文字幕| 亚洲精品乱码久久久久久日本蜜臀| 精品一区二区三区在线观看国产| 欧美日韩高清不卡| 亚洲一级片在线观看| 99国内精品久久| 中文字幕视频一区二区三区久| 国产一区福利在线| 精品噜噜噜噜久久久久久久久试看 | 成人一区在线看| 久久久99精品免费观看| 精品一区二区三区视频| 日韩一二在线观看| 蜜臂av日日欢夜夜爽一区| 91精品福利在线一区二区三区 | 国产suv精品一区二区三区| 欧美成人激情免费网| 麻豆国产欧美一区二区三区| 欧美一区二区黄| 另类中文字幕网| 久久精子c满五个校花|