Thema: FileListBox

Einzelnen Beitrag anzeigen

Benutzerbild von SaFu
SaFu

Registriert seit: 8. Nov 2006
1.360 Beiträge
 
Delphi 10.3 Rio
 
#4

Re: FileListBox

  Alt 7. Feb 2007, 16:07
Ja habe ich gemacht läuft auch solange nicht alle beide Anzeigen laufen

hier nochmal alle beide Formblätter.

Bilder Durchlauf und anzeige
Delphi-Quellcode:

unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Menus, JPEG,ShellAPI, GifImage, FileCtrl, ExtDlgs;

type
  TForm4 = class(TForm)
    Panel1: TPanel;
    Button4: TButton;
    FileListBox1: TFileListBox;
    Timer1: TTimer;
    GroupBox1: TGroupBox;
    Button2: TButton;
    Button3: TButton;
    Button5: TButton;
    GroupBox2: TGroupBox;
    Button6: TButton;
    Button1: TButton;
    Button7: TButton;
    OpenDialog1: TOpenDialog;
    Button10: TButton;
    Button9: TButton;
    Label1: TLabel;
    Image1: TImage;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    CheckBox1: TCheckBox;
    Label5: TLabel;
    Panel3: TPanel;
    Panel4: TPanel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FileListBox1Change(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);

  private
  n :integer; { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form4: TForm4;


implementation

uses Unit2, Unit8, Unit3, Unit9;

{$R *.dfm}
{Schließen}
procedure TForm4.Button4Click(Sender: TObject);
begin
  Form4.Close;
  Form2.Visible:= True;
end;


procedure TForm4.FormShow(Sender: TObject);
var i :integer;
begin
  n:= 2000; // Strart interval des Timers

  for i:=0 to ComponentCount-1 do // XP Anzeige
  if Components[i] is TPanel then (Components[i] as TPanel).ParentBackground:= False;

  FileListBox1.Directory:= ExtractFilePath(ParamStr(0))+'\Bilder\';
  
end;


{Ordner Anzeige}
procedure TForm4.FileListBox1Change(Sender: TObject);
var bild : string;
begin
  bild:= LowerCase(ExtractFileExt(FileListBox1.Filename));

  if (bild = '.jpg') then // Laden von JPG
    begin
     Image1.Picture.RegisterFileFormat('jpg', 'Jpeg', TjpegImage);
     Image1.Picture.LoadFromFile(FileListBox1.FileName);
    end;
end;

{Zeit des Durchlaufs}
procedure TForm4.Timer1Timer(Sender: TObject);
var bild,i : string;
begin
   if FileListBox1.Items.Count > 0 then
    begin
      if FileListBox1.ItemIndex+1 <> FileListBox1.Items.Count then
       begin
         i:= FileListBox1.Items[FileListBox1.Itemindex+1]; // hochzählen der datein
         FileListBox1.Filename:= i;
         bild:= Lowercase(ExtractFileExt(FileListBox1.Filename));

      if (bild = '.jpg') then
          begin
            Image1.Picture.RegisterFileFormat('jpg', 'Jpeg', TjpegImage);
            Image1.Picture.LoadFromFile(FileListBox1.Filename);
          end;

      
       if (bild = '.jpg') then
          begin
            Form3.Image1.Picture.RegisterFileFormat('jpg', 'Jpeg', TjpegImage);
            Form3.Image1.Picture.LoadFromFile(FileListBox1.Filename);
          end;
      
      end
    else
      begin
         i:= FileListBox1.Items[0];
         FileListBox1.Filename:= i;
       end;
    end;
end;

{Durchlaufs anhalten}
procedure TForm4.Button3Click(Sender: TObject);
begin
  Timer1.Enabled:= False;
end;

{Durschlaufstarten}
procedure TForm4.Button2Click(Sender: TObject);
begin
  Timer1.Enabled:= True;
end;

Dokumenten Durchlauf und Anzeige
Delphi-Quellcode:
unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,ShellApi, ExtCtrls, Printers, Menus, FileCtrl, ComCtrls;

type
  TForm5 = class(TForm)
    Panel1: TPanel;
    Button4: TButton;
    FileListBox2: TFileListBox;
    RichEdit1: TRichEdit;
    OpenDialog1: TOpenDialog;
    Timer1: TTimer;
    GroupBox1: TGroupBox;
    Button1: TButton;
    Button3: TButton;
    Button6: TButton;
    GroupBox2: TGroupBox;
    Button7: TButton;
    Button5: TButton;
    Button8: TButton;
    Button2: TButton;
    Label1: TLabel;
    Button9: TButton;
    Button10: TButton;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    CheckBox1: TCheckBox;
    Label5: TLabel;
    Panel3: TPanel;
    Panel2: TPanel;
    procedure Button4Click(Sender: TObject);
    procedure FormPaint(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FileListBox2Change(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure Button10Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    
  private
  n :integer; { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form5: TForm5;

implementation

uses Unit2, Unit9, Unit3, Unit8;

{$R *.dfm}
{Schließen}
procedure TForm5.Button4Click(Sender: TObject);
begin
  Form5.Close;
  Form2.Visible:= True;
end;

procedure TForm5.FormCreate(Sender: TObject);
var i :integer;
begin
    n:= 2000; // Strart interval des Timers

    for i:=0 to ComponentCount-1 do // XP Anzeige
    if Components[i] is TPanel then (Components[i] as TPanel).ParentBackground:= False;

    FileListBox2.Directory:= ExtractFilePath(ParamStr(0))+'\Dokumente nur RTF\';

    Label5.Caption:= 'LCD Anzeige der Dokumente'+#10+'Ein oder Ausschalten';
end;

procedure TForm5.Timer1Timer(Sender: TObject);
var a,dokus,test :string;
begin
   if FileListBox2.Items.Count > 0 then
    begin
      if FileListBox2.ItemIndex+1 <> FileListBox2.Items.Count then
       begin
        a:= FileListBox2.Items[FileListBox2.ItemIndex+1]; // hochzählen der datein
        FileListBox2.Filename:= a;
        dokus:= ExtractFileExt(FileListBox2.Filename);

     if (dokus = '.rtf') then
          begin
            Richedit1.PlainText:= False;
            Richedit1.Lines.LoadFromFile(FileListBox2.Filename);
            test:= Richedit1.Text
          end;
         end
     else
      begin
         a:= FileListBox2.Items[0];
         FileListBox2.Filename:= a;
      end;
    end;
end;

procedure TForm5.FileListBox2Change(Sender: TObject);
var dokus :string;
begin
  dokus:= LowerCase(ExtractFileExt(FileListBox2.Filename));
    if (dokus = '.rtf') then
      begin
        RichEdit1.PlainText := False;
        RichEdit1.Lines.LoadFromFile(FileListBox2.FileName);
      end;

    if (dokus = '.rtf') then
      begin
       Form9.RichEdit1.PlainText := False;
       Form9.Richedit1.Lines.LoadFromFile(FileListBox2.FileName);
      end;
end;

procedure TForm5.Button1Click(Sender: TObject);
begin
Timer1.Enabled:= True;
end;

procedure TForm5.Button3Click(Sender: TObject);
begin
 Timer1.Enabled:= False;
end
Gibt es vielleicht eine einfachere lösung mit der ich dieses realiesieren kann??????????
"... Wie gesagt, die Nutzer von 10, 12, 14 Zoll Display's werden deine Seite nicht in voller Pracht sehen können, ...

Surft Ihr mit dem Taschenrechner?"
  Mit Zitat antworten Zitat