Ver Mensaje Individual
  #1  
Antiguo 18-01-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
Barra de Progreso de Colores en Windows con Delphi 2010

Club Delphi,

Revisen este código:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, XPMan;

type
  TForm1 = class(TForm)
    ProgressBar1: TProgressBar;
    Button1: TButton;
    ComboBox1: TComboBox;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   ComboBox1.Items.Add('Green');
   ComboBox1.Items.Add('Yellow');
   ComboBox1.Items.Add('Red');
end;

procedure TForm1.Button1Click(Sender: TObject);
var
   i : Integer;

begin

   case ComboBox1.ItemIndex of
      0 : SendMessage(ProgressBar1.Handle,1040,1,0);
      1 : SendMessage(ProgressBar1.Handle,1040,3,0);
      2 : SendMessage(ProgressBar1.Handle,1040,2,0);
   end;

   ProgressBar1.Step := 1;
   ProgressBar1.Min := 0;
   ProgressBar1.Max := 10000;

   for i := 1 to 10000 do
      ProgressBar1.StepIt;

end;

end.
El código anterior en Delphi 2010 sobre Windows 7 Professional x32, permite implementar un componente TProgressBar en los colores Green, Yellow y Red como se muestra en la siguiente imagen a continuación:



Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 18-01-2014 a las 08:30:52.
Responder Con Cita