Ver Mensaje Individual
  #6  
Antiguo 19-02-2008
rauros rauros is offline
Miembro
 
Registrado: feb 2008
Ubicación: Alicante - Sax / Sax - Alicante
Posts: 235
Reputación: 17
rauros Va por buen camino
Ahí va el código, mira que quería registrarlo pero al final lo he puesto aquí xD.

Código Delphi [-]
unit Calculadoragangster;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ImgList;

  type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Button5: TButton;
    Label6: TLabel;
    Label7: TLabel;
    Image1: TImage;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  num1:longint;
  num2:longint;
  num3:longint;
  num4:longint;
  num5:longint;
  num6:longint;
  signo:integer;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:='+';
label1.visible:=true;
label6.visible:=true;
label7.visible:=true;
label6.Caption:='Gangs';
label7.Caption:='entran';
signo := 1;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
label1.Caption:='-';
signo:=2;
label1.visible:=true;
label6.visible:=true;
label7.visible:=true;
label6.Caption:='Gangs';
label7.Caption:='mueren';
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
label1.Caption:='*';
label1.visible:=true;
label6.visible:=true;
label7.visible:=true;
label6.Caption:='llaman';
label7.Caption:='por cada uno';
signo:=3;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
label1.Caption:='/';
signo:=4;
label1.visible:=true;
label6.visible:=true;
label7.visible:=true;
label6.Caption:='gangs';
label7.Caption:='grupos';
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
if TryStrToInt(Edit1.Text, num1) and TryStrToInt(Edit2.Text, num2) then begin
  if num2 = 0 then begin
  Application.MessageBox('Ese numero no es gangsteable','Calculadora Lil Ezek',16) ;
  end
  else begin
  num1 := StrToInt(edit1.text);
  num2 := StrToInt(edit2.text);
  num3:= num1 + num2;
  num4:= num1 - num2;
  num5:= num1 * num2;
  num6:= num1 DIV num2;
  label4.visible:=true;
  label5.visible:=true;
  case signo of
  1:label5.caption := IntToStr(num3) + ' gangs';
  2:label5.caption := IntToStr(num4) + ' gangs';
  3:label5.caption := IntToStr(num5) + ' gangs llamados';
  4:label5.caption := IntToStr(num6) + ' x grupo';
  end;
  end
end
else
begin
Application.MessageBox('Ese numero no es gangsteable','Calculadora Lil Ezek',16) ;
edit1.text:= '';
edit2.Text:= '';
label5.caption:= '';
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Image1.Picture.LoadFromFile('fondo.bmp');
end;

end.
Código Delphi [-]
object Form1: TForm1
  Left = 475
  Top = 347
  Width = 385
  Height = 323
  Caption = 'Calculadora Lil Ezek'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Image1: TImage
    Left = 0
    Top = 0
    Width = 377
    Height = 289
  end
  object Label1: TLabel
    Left = 96
    Top = 32
    Width = 3
    Height = 13
    Visible = False
  end
  object Label2: TLabel
    Left = 112
    Top = 208
    Width = 147
    Height = 13
    Caption = 'By ezequiel santamaria navarro'
  end
  object Label3: TLabel
    Left = 152
    Top = 224
    Width = 80
    Height = 13
    Caption = 'ezeali@msn.com'
  end
  object Label4: TLabel
    Left = 248
    Top = 32
    Width = 6
    Height = 13
    Caption = '='
    Visible = False
  end
  object Label5: TLabel
    Left = 264
    Top = 32
    Width = 3
    Height = 13
    Visible = False
  end
  object Label6: TLabel
    Left = 40
    Top = 32
    Width = 3
    Height = 13
    Visible = False
  end
  object Label7: TLabel
    Left = 187
    Top = 32
    Width = 3
    Height = 13
    Visible = False
  end
  object Button1: TButton
    Left = 144
    Top = 104
    Width = 25
    Height = 25
    Caption = '+'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 200
    Top = 104
    Width = 25
    Height = 25
    Caption = '-'
    TabOrder = 1
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 144
    Top = 136
    Width = 25
    Height = 25
    Caption = '*'
    TabOrder = 2
    OnClick = Button3Click
  end
  object Button4: TButton
    Left = 200
    Top = 136
    Width = 25
    Height = 25
    Caption = '/'
    TabOrder = 3
    OnClick = Button4Click
  end
  object Edit1: TEdit
    Left = 0
    Top = 32
    Width = 41
    Height = 21
    TabOrder = 4
  end
  object Edit2: TEdit
    Left = 144
    Top = 32
    Width = 41
    Height = 21
    TabOrder = 5
  end
  object Button5: TButton
    Left = 144
    Top = 168
    Width = 81
    Height = 25
    Caption = '='
    TabOrder = 6
    OnClick = Button5Click
  end
end

Código Delphi [-]
program CalcG;

uses
  Forms,
  Calculadoragangster in 'Calculadoragangster.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Responder Con Cita