Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Diashowbildwechsel (https://www.delphipraxis.net/68741-diashowbildwechsel.html)

TurboMartin 4. Mai 2006 15:17


Diashowbildwechsel
 
Hi, Ich habe ein problem:
ich möchte bei einem Diashowprogramm den bildwechsel mit nem Timer zeitsteuer. Alles funktioniert, bis auf den bildwechsel.
den kapier ich nicht. ich möcht ein bild nach dem anderen aus ner filelistbox laden.
Hier der gesamte Code:
Code:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "image1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
Panel1->Visible = false;
Timer1->Enabled = true;
Timer1->Interval = IntToStr(nextp)*1000;
Image1->Visible = true;
Form1->BorderStyle = bsNone;
Form1->WindowState = wsMaximized;
Image1->Height = Form1->ClientHeight;
Image1->Width = Form1->ClientWidth;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormClick(TObject *Sender)
{
Panel2->Visible = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
Panel2->Visible = false;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2Click(TObject *Sender)
{
Panel2->Visible = false;
Image1->Visible = false;
Panel1->Visible = true;
Timer1->Enabled = false;
Timer2->Enabled = false;
Form1->WindowState = wsNormal;
Form1->BorderStyle = bsSizeable;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1Click(TObject *Sender)
{
Panel2->Visible = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormResize(TObject *Sender)
{
Image1->Height = Form1->ClientHeight;
Image1->Width = Form1->ClientWidth;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DirectoryListBox1Change(TObject *Sender)
{
FileListBox1->Directory = DirectoryListBox1->Directory;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DriveComboBox1Change(TObject *Sender)
{
DirectoryListBox1->Drive = DriveComboBox1->Drive;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
//Hier das nächste Bild laden
}
//---------------------------------------------------------------------------
wie muss ich das jetzt machen?

turboPASCAL 4. Mai 2006 16:13

Re: Diashowbildwechsel
 
Code:
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{

  if (ListBox1->ItemIndex < ListBox1->Items.Count - 1) {
    ListBox1->ItemIndex := ListBox1->ItemIndex + 1 } //  ListBox1->ItemIndex++
  else
  {
    ListBox1.ItemIndex := 0;

    // oder Messagebox mit Listenende erreicht bla...
  }

  Image1->Picture->LoadFromFile( ListBox1->Items[ ListBox1->ItemIndex ] );


}
So ? :gruebel:

TurboMartin 6. Mai 2006 11:50

Re: Diashowbildwechsel
 
ne, ich hab ne filelistbox, und keine listbox. und umändern geht nicht.
hat sonst jemand ne idee, oder kennt einer ein c++ forum :?: :dance:

Hador 6. Mai 2006 12:08

Re: Diashowbildwechsel
 
Liste der Anhänge anzeigen (Anzahl: 1)
Der Code von Turbopascal passt schon. Du musst nur statt ListBox FileListBox nehmen.

Ich habe sowas in der Art auch schon mal gemacht. Ich häng dir mein Projekt mal an.
ggf. hilft dir das ja.

TurboMartin 6. Mai 2006 12:19

Re: Diashowbildwechsel
 
von listbox nach filelistboxy funktioniert nicht, da krieg ich etwa 10-15 fehler

[edit]ich krieg das nicht ausgeführt. muss ihregendeine jcl.bpi angeben. und wenn ich zweimal auf cancel drücke, öffnet der compiller sich, aber dan krieg ich nen "Linker Fatal Error"

Hador 6. Mai 2006 13:54

Re: Diashowbildwechsel
 
Komisch :gruebel:

Sonst guck dir mal einfach die Funktion nextpic() aus meinem Projekt an:

Code:
//---------------------------------------------------------------------------
void __fastcall TImgViewerForm::nextPic()
{
  if (Files->ItemIndex == Files->Count-1) {
    Files->ItemIndex = 0;
  } else {
    Files->ItemIndex = Files->ItemIndex+1;
  }
  Image->Picture->LoadFromFile(Files->Items->Strings[Files->ItemIndex]);
  PictureName->Caption = Files->Directory +"\\"+ Files->Items->Strings[Files->ItemIndex];

}
Files ist bei mir eine TFileListBox.
So funktioniert es zumindest bei mir.

Sonst kannst du mir ja wenn du willst dein Projekt mal per PN zuschicken.
Ich würde mir das mdann mal angucken.

TurboMartin 6. Mai 2006 14:00

Re: Diashowbildwechsel
 
bessser nicht, außer du willst nen virus :mrgreen:


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:59 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz