viernes, 15 de mayo de 2009

CONTRASEÑA UN NOMBRE UNA CONTRASEÑA


procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
IF KEY=#13 THEN
edit2.SetFocus

end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE

end;

procedure TForm1.Edit2Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE

end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
IF((LOWERCASE(EDIT1.Text)='tengo')and(LOWERCASE(EDIT2.Text)='sueño'))then
begin
timer1.enabled:=False;
MESSAGEDLG('INGRESO AL SISTEMA CORRECTAMENTE'#13'BIENVENIDO ',MTINFORMATION,[mbOK],1);
close
end
else if FORM1.Tag<4>=4 THEN
BEGIN
TIMER1.ENABLED:=FALSE;
MESSAGEDLG('USUARIO NO AUTORIZADO',MTWARNING,[MbOK],1);
close
end
else
begin
FORM1.Tag:=FORM1.Tag+1;
EDIT1.SelStart:=0;
EDIT1.SelLength:=LENGTH(EDIT1.Text);
EDIT1.CLEAR;
EDIT2.CLEAR;
EDIT1.SetFocus
END;


end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
label4.Caption:='le resta '+inttostr(timer1.Tag)+' seg';
TIMER1.Tag:=TIMER1.Tag-1;
IF TIMER1.Tag=0 THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL4.Caption:='';
APPLICATION.MessageBox('SE CERRARA EL SISTEMA',' TIEMPO AGOTADO',MB_OK);
CLOSE

end;
end;
end.

martes, 12 de mayo de 2009

GRAFICOS EN DELPHI

begin
canvas.Pen.Color:=clgreen;
canvas.MoveTo(100,100);
canvas.LineTo(200,200);

canvas.Pen.Color:=clyellow;
Canvas.Brush.Color := clblue;
Canvas.Brush.Style := bsDiagCross;
Canvas.Ellipse(0, 0, Image1.Width, Image1.Height);
end;


begin
canvas.Pen.Color:=clyellow;
canvas.MoveTo(300,300);
canvas.LineTo(200,200);

end;
begin
Canvas.pen.Style:=pssolid;
canvas.Pen.Color:=clred;
Canvas.Brush.Color := clblue;
Canvas.Brush.style:=bsHorizontal ;

canvas.Polygon([point(400,400),point(400,500),point(500,500),point(500,500)]);
end;

begin
canvas.Pen.Color:=cllime;
Canvas.pen.Style:=psDashDotDot;
canvas.Arc(100,300,300,600,0,0,0,0);

end;
end;
end.

viernes, 1 de mayo de 2009

Salario con un aumento arriba de las 30 hr y in impuesto de 20


unit salario;

interface

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

type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);
var tar,sal,num:real;
mane:string;

begin
tar:=strtofloat(edit1.Text);
num:=strtofloat(edit2.Text);
name:=(edit3.Text);
sal:=(tar*num);
if sal>100 then
begin
sal:=(tar*num)-tar*num*0.2;
//tar*num*0.2 es el impuesto del 20%;
edit4.Text:=floattostr(sal)+ ' Bs de sueldo de '+(name);
end

else
// condicionante indicando si elnumero de horas que setrabajanesmayor
//a 30 horas hay un aumento de 60% y tb descopntando elimpuesto;
if num>30 then
begin
sal:=(tar*num+tar*num*0.6-tar*num*0.2);


edit4.Text:=floattostr(sal); end
end;

// colocamoseste boton para que borre datos anteriores
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit1.SetFocus;
// naden sus dudas en la misma pagina
end;


end.

Multiplicacion de menores y divicion de mayores


unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure BitBtn1Click(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1ClickSender:TObject);
var
a:integer;
b:integer;
c:integer;
d:integer;
m,n:real;
begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=StrToInt(Edit3.Text);
d:=StrToInt(Edit4.Text);

if((a>b) and (a>c) and (a>d))then
begin
if((b>c)and (b>d))then
begin
m:=a/b;
n:=c*d;
end;
else
begin
If((c>b)and (c>d))then
begin
m:=a/c;
n:=b*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((d>c)and(d>b))then
begin
m:=a/d;
n:=b*c;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;

end
else
begin
if((b>a) and (b>c) and (b>d))then
begin//inicio
if((a>c)and (a>d))then
begin
m:=b/a;
n:=c*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((c>a)and (c>d))then
begin
m:=b/c;
n:=a*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((d>a)and(d>c))then
begin
m:=b/d;
n:=a*c; edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;


end//fin
else
begin
if((c>a) and (c>b) and (c>d))then
begin//inicio
if((a>b)and (a>d))then
begin
m:=c/a;
n:=b*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((b>a)and (b>d))then
begin
m:=c/b;
n:=a*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((d>a)and(d>b))then
begin
m:=c/d;
n:=a*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;
end//final
else
begin
if((d>a) and (d>b) and (d>c))then
begin//inicio
if((a>b)and (a>c))then
begin
m:=d/a;
n:=c*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((b>a)and (b>d))then
begin
m:=d/b;
n:=a*c;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((c>a)and(c>b))then
begin
m:=d/c;
n:=a*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;

end;//final

end;
end;

end;


end;
end.