1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
| unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DB, DBTables, ExtCtrls, Buttons;
type
TForm6 = class(TForm)
StringGrid1: TStringGrid;
Label1: TLabel;
Image1: TImage;
Label2: TLabel;
SpeedButton1: TSpeedButton;
Button1: TButton;
Label3: TLabel; // Classe : ce que je veux prendre comme nom pour mon fichier
Button2: TButton;
Memo1: TMemo;
procedure StringGrid1Click(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
test : String;
end;
var
Form6: TForm6;
mot : String;
implementation
uses Unit5, Unit3;
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
begin
form3.show;
hide;
end;
procedure TForm6.Button2Click(Sender: TObject); // inutile, je supprimerais
begin
Form6.Show;
end;
procedure TForm6.Image1Click(Sender: TObject);
begin
Image1.Picture.LoadFromFile('C:\Users\Malik\Desktop\Projet IHM\emp.bmp')
end;
procedure TForm6.SpeedButton1Click(Sender: TObject);
var
nom: String ;
inc : integer;
begin
Form5.Label1.Caption:= nom;
begin
Form5.Show ;
hide;
end;
end;
procedure TForm6.StringGrid1Click(Sender: TObject);
var
i,j,k,l : integer;
begin
with StringGrid1 do
begin
Cells[0,0]:='Elève';
Cells[1,0]:='Note';
end;
i:=1;
j:=1;
// Ajout nom
while i<(Form6.Memo1.Lines.Count -1 ) do
begin
mot:=Form6.Memo1.Lines.Strings[i] ;
with StringGrid1 do
begin
Cells[0, j] := mot;
j:=j+1;
Inc(i,8);
end;
end;
l:=7;
k:=1;
// Ajout note
while l<(Form6.Memo1.Lines.Count ) do
begin
mot:=Form6.Memo1.Lines.Strings[l] ;
with StringGrid1 do
begin
Cells[1, k] := mot;
end;
k:=k+1;
Inc(l,8);
end;
end;
// Procedure pour afficher la fiche eleve en cliquant sur son nom
procedure TForm6.StringGrid1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Column, Row: Integer;
nom: String ;
// prenom, classe, adresse: String ;
i : integer;
begin
StringGrid1.MouseToCell(X, Y, Column, Row);
if (Column > -1) and (Column < 1) and (Row > -1) then
with Stringgrid1 do
begin
for i := 0 to Form6.Memo1.Lines.Count - 1 do
begin
nom :=Form6.Memo1.Lines.Strings[i+1] ;
// prenom :=Form6.Memo1.Lines.Strings[i+2] ;
// classe :=Form6.Memo1.Lines.Strings[i+4] ;
// adresse :=Form6.Memo1.Lines.Strings[i+5] ;
if (CompareStr(nom, Cells[Column,Row]) = 0) then
Form5.Label1.Caption:= nom;
// Form5.Label2.Caption:= prenom;
// Form5.Label3.Caption:= classe;
// Form5.Label5.Caption:= adresse;
Form5.Show ;
Form6.close;
end;
end;
end;
// procedure TForm6.FormCreate(Sender: TObject);
// var
// addFichier : String;
// nomF : String;
//begin
// nomF:=Form3.ClasseP;
// addFichier:='db\'+nomF+'.txt';
// if (FileExists(addFichier)) then
// begin
// Memo1.Lines.LoadFromFile(addFichier) ;
// end
// else
//Memo1.Lines.SaveToFile(addFichier) ;
//end;
//procedure TForm6.FormCreate(Sender: TObject);
//begin
// showmessage('Dans le Create : '+Label3.Caption);
//end;
//
//procedure TForm6.FormShow(Sender: TObject);
//begin
// showmessage('Dans le show : '+Label1.Caption);
//end;
end. |
Partager