Einzelnen Beitrag anzeigen

Todd

Registriert seit: 27. Jun 2007
25 Beiträge
 
#6

Re: Lauftext in der Titelleiste ?

  Alt 9. Jun 2008, 14:51
Hallo,

meine erste Anfangslösung, da es mich selbst interessiert hat. Aber irgendwie komme ich nun nicht mehr weiter. Das ganze wirkt ob der Farbgebung doch recht merkwürdig. Vielleicht kann man ja dem Canvas einen transparenten Hintergrund verschaffen?

Delphi-Quellcode:
C++ Quellcode Datei
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int x;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
  x      = 200;
  FLAG    = 0;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
  if (FCanvas)
    {
      if (x == 80)  FLAG = 1;
      if (x == 200) FLAG = 0;
      SetNewPos();
      FCanvas->TextOutA(x,8,"Lauftext");
    }

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
  FCanvas              = new TCanvas;
  FCanvas->Handle      = GetWindowDC(Handle);
  FCanvas->Brush->Color = clGreen;
  FCanvas->Font->Color  = clWhite;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
  delete FCanvas;
}

//---------------------------------------------------------------------------
void __fastcall TForm1::SetNewPos()
{
if (FLAG == 0) x--;
else          x++;
}
Delphi-Quellcode:
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:   // IDE-managed Components
   TTimer *Timer1;
   void __fastcall Timer1Timer(TObject *Sender);
   void __fastcall FormShow(TObject *Sender);
   void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:   // User declarations
   void __fastcall SetNewPos();
public:      // User declarations
   __fastcall TForm1(TComponent* Owner);
   TCanvas* FCanvas;
   int FLAG;
}
;
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Sorry für den C++ Code, hatte keine Zeit das in Pascal zu ändern...

Wie gesagt es funktioniert teilweise, die Farbgebung stimmt nicht, aber einfach selbst testen...
  Mit Zitat antworten Zitat