Sie sind auf Seite 1von 7

RAMREZ CARDONA LUIS

end;//End For
If flag=0 Then
ComboBox1.Items.Add(Edit2.Text);
Edit1.Text:='';
interface
Edit2.Text:='';
Edit3.Text:='';
uses
Edit1.Focused;
Windows, Messages, SysUtils, Variants, Classes, Graphics, end;
Controls, Forms,
procedure TForm1.FormCreate(Sender: TObject);
Dialogs, StdCtrls;
begin
cont:=0;
type
Edit1.Text:='';
TForm1 = class(TForm)
Edit2.Text:='';
Label1: TLabel;
Edit3.Text:='';
Label2: TLabel;
end;
Label3: TLabel;
procedure TForm1.ComboBox1Change(Sender: TObject);
Edit1: TEdit;
Var
Edit2: TEdit;
x:integer;
Edit3: TEdit;
begin
Button1: TButton;
ListBox4.Clear;
Button2: TButton;
For x:=0 To ListBox2.Items.Count-1 Do
ListBox1: TListBox;
If
ListBox2: TListBox;
LowerCase(ComboBox1.Text)=LowerCase(ListBox2.Items[x
ListBox3: TListBox;
]) Then
ListBox4: TListBox;
ListBox4.Items.Add(ListBox1.Items[x]
ComboBox1: TComboBox;
+'-'+ListBox2.Items[x]);
procedure Button1Click(Sender: TObject);
end;
procedure FormCreate(Sender: TObject);
procedure TForm1.Button2Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
Var
procedure Button2Click(Sender: TObject);
x,y,flag:integer;
private
begin
{ Private declarations }
ListBox4.Clear;
public
For x:=0 To ListBox3.Items.Count-1 Do
{ Public declarations }
begin
end;
flag:=0;
for y:=0 To Listbox4.Items.Count-1 Do
var
begin
cont: Integer;
If ListBox3.Items[x]=ListBox4.Items[y] Then
Form1: TForm1;
flag:=1;
implementation
end;//end for interno
If flag=0 Then
{$R *.dfm}
ListBox4.Items.Add(ListBox3.Items[x]);
end;//end for principal
procedure TForm1.Button1Click(Sender: TObject);
end;//end button2click
var
x: Integer;//indice para el listbox
end.
flag: Integer;
begin
flag:=0;
ListBox1.Items.Add(Edit1.Text);
ListBox2.Items.Add(Edit2.Text);
ListBox3.Items.Add(Edit3.Text);
For x:=0 to ComboBox1.Items.Count-1 do
begin
If
LowerCase(Edit2.Text)=LowerCase(ComboBox1.Items[x])
Then
begin
flag:=1;
PROGRAMA 2
end;
unit Unit1;
PROGRAMA 1
unit Unit1;

RAMREZ CARDONA LUIS


procedure TForm1.Button1Click(Sender: TObject);
Var
a,b:Integer;
uses
begin
Windows, Messages, SysUtils, Variants, Classes, Graphics, For a:=1 To 10 Do
Controls, Forms,
begin
Dialogs, StdCtrls, Menus;
For b:=1 To 5 Do
begin
type
Label1.Caption:=Label1.Caption+IntToStr(b)
TForm1 = class(TForm)
+'x'+IntToStr(a)+'='+IntToStr(b*a)+' ';
Button1: TButton;
end;
Button2: TButton;
Label1.Caption:=Label1.Caption+#10;
Button3: TButton;
end;
Button4: TButton;
Label1.Caption:=Label1.Caption+#10+#10;
ComboBox1: TComboBox;
For a:=1 To 10 Do
Edit1: TEdit;
begin
Label1: TLabel;
For b:=6 To 10 Do
Label2: TLabel;
begin
PopupMenu1: TPopupMenu;
Label1.Caption:=Label1.Caption+IntToStr(b)
Azul1: TMenuItem;
+'x'+IntToStr(a)+'='+IntToStr(b*a)+' ';
Verde1: TMenuItem;
end;
rojo1: TMenuItem;
Label1.Caption:=Label1.Caption+#10;
procedure FormCreate(Sender: TObject);
end;
procedure Button1Click(Sender: TObject);
end;
procedure Button2Click(Sender: TObject);
procedure Azul1Click(Sender: TObject);
procedure TForm1.Button2Click(Sender: TObject);
procedure Verde1Click(Sender: TObject);
Var
procedure rojo1Click(Sender: TObject);
a:Integer;
procedure ComboBox1Change(Sender: TObject);
begin
procedure Button3Click(Sender: TObject);
If Edit1.Text='' Then
procedure Button4Click(Sender: TObject);
ShowMessage('Campo vacio, introduce un numero')
Else
private
For a:=1 To 10 Do
{ Private declarations }
begin
public
{ Public declarations }
Label2.Caption:=Label2.Caption+Edit1.Text+'x'+IntToStr(a)
end;
+'='+IntToStr(a*StrToInt(Edit1.Text))+#10;
end;
var
cont: Integer;
Form1: TForm1;
end;
implementation
procedure TForm1.Azul1Click(Sender: TObject);
{$R *.dfm}
begin
Label1.Font.Color:=clBlue;
Label2.Font.Color:=clBlue;
Edit1.Font.Color:=clBlue;
end;
procedure TForm1.FormCreate(Sender: TObject);
Var
procedure TForm1.Verde1Click(Sender: TObject);
x:Integer;
begin
begin
Label1.Font.Color:=clGreen;
Combobox1.Text:='';
Label2.Font.Color:=clgreen;
For x:=8 To 30 Do
Edit1.Font.Color:=clGreen;
Combobox1.Items.Add(IntToStr(x));
end;
Label1.Caption:='';
Label2.Caption:='';
procedure TForm1.rojo1Click(Sender: TObject);
Edit1.Text:='';
begin
end;
Label1.Font.Color:=clRed;
Label2.Font.Color:=clRed;
interface

RAMREZ CARDONA LUIS


Edit1.Font.Color:=clRed;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
Edit1.Font.Height:=StrToInt(Combobox1.Text);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label1.Caption:='';
Label2.Caption:='';
Edit1.Text:='';
Combobox1.Text:='';
Edit1.Height:=21;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Form1.Close();
end;
end.

PROGRAMA 3
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,

RAMREZ CARDONA LUIS


Dialogs, StdCtrls;

mayusculas las iniciales


inicio,fin:integer;//posiciones desde la scuales cortar la
type
cadena
TForm1 = class(TForm)
begin
Label1: TLabel;
inicio:=Pos('-',ListBox1.Items[ListBox1.ItemIndex])
Label2: TLabel;
+1;//Valor que almacena la posicion de inicio del sueldo
Edit1: TEdit;
dentro de la cadena, es decir, despues de guion Edit2: TEdit;
fin:=Length(ListBox1.Items[ListBox1.ItemIndex])Button1: TButton;
inicio+1;//valor que almacena el largo del sueldo
ComboBox1: TComboBox;
b:=Copy(ListBox1.Items[ListBox1.ItemIndex],inicio,fin);//in
Button2: TButton;
struccion que corta el sueldo de la cadena con los parametros
ListBox1: TListBox;
anteriores
procedure Button1Click(Sender: TObject);
Edit2.Text:=b;//la variable b se usa aqui para guardar el valor
procedure FormCreate(Sender: TObject);
del sueldo extraido de la cadena original
procedure ListBox1Click(Sender: TObject);
fin:=Pos('-',ListBox1.Items[ListBox1.ItemIndex])-1;//se
private
cambia el valor del final de la cadena para que corresponda
{ Private declarations }
con el final del nombre, es decir hasta antes del guion public
a:=Copy(ListBox1.Items[ListBox1.ItemIndex],1,fin);//la
{ Public declarations }
variabel a guarda el nombre con los parametros establecidos
end;
antes
//ya que se extrajo el nombre, inicia el procedimiento para
var
hacer las iniciales del nombre mayusculas
Form1: TForm1;
a:=LowerCase(a);//Se hace primero minusculas todas las
letras de la cadena con el nombre
implementation
b:=UpperCase(Copy(a,1,1));//la variable b se usara para ir
copiando los caracteres de la cadena a, que almacena el
{$R *.dfm}
nombre
For x:=2 to Length(a) Do
procedure TForm1.Button1Click(Sender: TObject);
begin
Var
If a[x-1]=' ' Then//si el caracter en la posicion anterior al
x,flag:Integer;
indice es un espacio en blanco, se asume que el caracter
begin
actual es la inicial del nombre o apellidos
ListBox1.Items.Add(UpperCase(Edit1.Text)+'-'+Edit2.Text); begin
flag:=0;
b:=b+UpperCase(Copy(a,x,1));//y se copia dicho caracter a
For x:=0 To ComboBox1.Items.Count-1 Do
la cadena b, pero en mayuscula
begin
end;
If Edit2.Text=ComboBox1.Items[x] Then
If a[x-1]<>' ' Then//si el caracter anterior al del indice no es
begin
un espacio, se asume que es una letra dentro del nombre
flag:=1;
begin
end;
b:=b+LowerCase(Copy(a,x,1));//y por tanto se copia a "b"
end;
pero como minuscula
If flag=0 Then
end; //y asi hasta terminar de recorrer la cadena a, que
ComboBox1.Items.Add(Edit2.Text);
almacena el nombre
Edit1.Text:='';
end;
Edit2.Text:='';
Edit1.Text:=b;//una vez terminado, se inserta la cadena en la
end;
caja de texto solicitada :3
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end.
Edit1.Text:='';
Edit2.Text:='';
PROGRAMA 4
ComboBox1.Text:='';
unit Unit1;
end;
//Codigo para pasar el nombre y sueldo a los edit 1 y 2 y para interface
poner la sinicialez del nombre en mayusculas
procedure TForm1.ListBox1Click(Sender: TObject);
uses
Var
Windows, Messages, SysUtils, Variants, Classes, Graphics,
a,b:String;//cadenas para guardar el nombre y sueldo
Controls, Forms,
respectivamente
Dialogs, ComCtrls, StdCtrls, ImgList;
x:Integer;//Indice para recorrer el nombre y cambiar a

RAMREZ CARDONA LUIS


type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
ListView1: TListView;
ImageList1: TImageList;
Button2: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text:='';
Edit2.Text:='';
Edit3.Text:='';
end;
procedure TForm1.Button1Click(Sender: TObject);
Var
t:TListItem;
prom: Double;
a,b,c:String;
begin
a:=Edit1.Text;
b:=Edit2.Text;
c:=Edit3.Text;
prom:= (StrToInt(Edit2.Text)+StrToInt(Edit3.Text))/2;
t:=ListView1.Items.Add;
t.SubItems.Add(a);
t.SubItems.Add(b);
t.SubItems.Add(c);
t.SubItems.Add(FloatToStr(prom));
If prom<6 Then
begin
t.ImageIndex:=0;
end;
If prom>6 Then
begin
t.ImageIndex:=1;
end;
Edit1.Text:='';

Edit2.Text:='';
Edit3.Text:='';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ListView1.ViewStyle:=vsIcon;
end;
end.

RAMREZ CARDONA LUIS


PROGRAMA 5
unit Unit1;
interface

begin
ListBox1.Items.Add(FileListBox1.FileName);
end;

procedure TForm1.Button2Click(Sender: TObject);


Var
uses
f:textfile;
Windows, Messages, SysUtils, Variants, Classes, Graphics, x:Integer;
Controls, Forms,
//s:String;
Dialogs, StdCtrls, FileCtrl;
begin
assignfile(f,'d:\datos.txt');
type
If FileExists('d:\datos.txt') Then
TForm1 = class(TForm)
//ShowMessage('Escribiendo sobre el archivo');
DriveComboBox1: TDriveComboBox;
append(f)
FileListBox1: TFileListBox;
else
DirectoryListBox1: TDirectoryListBox;
//ShowMessage('Creando archivo');
Memo1: TMemo;
rewrite(f);
ComboBox1: TComboBox;
For x:=0 To ListBox1.Items.Count-1 Do
ListBox1: TListBox;
begin
Button1: TButton;
a:=ListBox1.Items[x];
Button2: TButton;
writeln(f,a);
Button3: TButton;
end;
procedure DriveComboBox1Change(Sender: TObject);
closefile(f);
procedure DirectoryListBox1Change(Sender: TObject);
end;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure TForm1.ListBox1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
begin
procedure FormCreate(Sender: TObject);
//a:=ListBox1.Items[ListBox1.ItemIndex];
procedure ComboBox1Change(Sender: TObject);
end;
procedure FileListBox1DblClick(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure TForm1.FormCreate(Sender: TObject);
private
begin
{ Private declarations }
ComboBox1.Text:='';
public
ComboBox1.Items.Add('.txt');
{ Public declarations }
ComboBox1.Items.Add('.BMP');
end;
ComboBox1.Items.Add('*.*');
Memo1.Text:='';
var
end;
a:String;
Form1: TForm1;
procedure TForm1.ComboBox1Change(Sender: TObject);
Var
implementation
a:String;
begin
{$R *.dfm}
a:=ComboBox1.Text;
FileListBox1.Mask:='*'+a;
procedure TForm1.DriveComboBox1Change(Sender:
end;
TObject);
begin
DirectoryListBox1.Drive:=DriveComboBox1.Drive;
end;
procedure TForm1.FileListBox1DblClick(Sender: TObject);
Var
procedure TForm1.DirectoryListBox1Change(Sender:
s,a:String;
TObject);
l,inicio,fin:Integer;
begin
x:Integer;
FileListBox1.Directory:= DirectoryListBox1.Directory;
begin
end;
a:=FileListBox1.Items[FileListBox1.ItemIndex];
l:=Length(a);
inicio:=Pos('.',a);
procedure TForm1.Button1Click(Sender: TObject);
fin:=(l-inicio)+1;

RAMREZ CARDONA LUIS


s:=Copy(a,inicio,fin);
If s='.txt' Then
Memo1.Lines.LoadFromFile(a);
end;
procedure TForm1.Button3Click(Sender: TObject);
Var
f:TextFile;
s:String;
begin
ListBox1.Clear();
ShowMessage('Leyendo archivo');
assignfile(f,'d:\datos.txt');
reset(f);
while not eof(f) do
begin
readln(f,s);
ListBox1.Items.Add(s);
end;
closefile(f);
end;

end.

Das könnte Ihnen auch gefallen