Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #36  
Antiguo 17-06-2008
[FGarcia] FGarcia is offline
Miembro Premium
 
Registrado: sep 2005
Ubicación: Cordoba, Veracruz, México
Posts: 1.123
Poder: 22
FGarcia Va por buen camino
Aqui mi contribucion a este hilo usando el codigo de este otro hilo:

Código Delphi [-]
//Declaramos una variable de tipo byte
var
  Form1: TForm1;
  bValor: byte;

//Creamos esta funcion para convertir el valor entero en una cadena binaria
function TForm1.IntToBinStr(num: integer): string;
var
   i: integer;
begin
   for i := 0 to 7 do
      Result := IntToStr((num shr i) and 1)+ Result;
end;
 
//Esta es la funcion de los led y shapes
procedure TForm1.EnciendeLED;
begin
  //esta etiqueta es nueva
  Label15.Caption := IntToStr(bValor);
  
 if StrToInt(MidStr(IntToBinStr(bValor), 1, 1)) = 0 then
    begin
      Shape8.Brush.Color := clLime;
      Edit8.Text := '0';
    end
  else
    begin
      Shape8.Brush.Color := clMoneyGreen;
      Edit8.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 2, 1)) = 0 then
    begin
      Shape7.Brush.Color := clLime;
      Edit7.Text := '0';
    end
  else
    begin
      Shape7.Brush.Color := clMoneyGreen;
      Edit7.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 3, 1)) = 0 then
    begin
      Shape6.Brush.Color := clLime;
      Edit6.Text := '0';
    end
  else
    begin
      Shape6.Brush.Color := clMoneyGreen;
      Edit6.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 4, 1)) = 0 then
    begin
      Shape5.Brush.Color := clLime;
      Edit5.Text := '0';
    end
  else
    begin
      Shape5.Brush.Color := clMoneyGreen;
      Edit5.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 5, 1)) = 0 then
    begin
      Shape4.Brush.Color := clLime;
      Edit4.Text := '0';
    end
  else
    begin
      Shape4.Brush.Color := clMoneyGreen;
      Edit4.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 6, 1)) = 0 then
    begin
      Shape3.Brush.Color := clLime;
      Edit3.Text := '0';
    end
  else
    begin
      Shape3.Brush.Color := clMoneyGreen;
      Edit3.Text := '1';
    end;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 7, 1)) = 0 then
    begin
      Shape2.Brush.Color := clLime;
      Edit2.Text := '0';
    end
  else
    begin
      Shape2.Brush.Color := clMoneyGreen;
      Edit2.Text := '1';
    end ;
 
  if StrToInt(MidStr(IntToBinStr(bValor), 8, 1)) = 0 then
    begin
      Shape1.Brush.Color := clLime;
      Edit1.Text := '0';
    end
  else
    begin
      Shape1.Brush.Color := clMoneyGreen;
      Edit1.Text := '1';
    end ;
end;

//Cuando cambia el valor de TrackBar al cual llamamos tbValor
procedure TForm1.tbValorChange(Sender: TObject);
begin
  bValor := tbValor.position;
  EnciendeLED;
end;

Como siempre se aceptan criticas constructivas, destructivas, orientativas y sin sentido!!

¡¡Prohibido desvirtuar este hilo!!
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Cambiando el Color de la Barra Selectora del DBGrid enecumene OOP 5 21-04-2008 23:24:02
como cambiar color a un shape blackpic Varios 3 06-01-2008 00:28:00
Cambiando el codigo de delphi a builder... paco_galo C++ Builder 5 03-12-2007 22:14:54
asignar color a un shape NSL94 Impresión 4 11-07-2007 09:33:04
Cambiando a C# y .NET waltergomez La Taberna 10 01-08-2006 02:57:18


La franja horaria es GMT +2. Ahora son las 20:29:51.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi