Autor Beitrag
Spatz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Do 12.05.05 11:43 
Mein Problem:

Ich erstelle ein TBitmap und zeichne darauf. jetzt läuft mein Programm in einer Schlaufe und zeichnet dieses Bitmap immer wieder als Hintergrund auf eine PaintBox. Aber plötzlich (unregelmässig) verschwindet dieses Bild und wird nicht mehr gezeichnet... (ich ändere nichts an der Bitmap)

Hat jemand eine Ahnung, was dies sein könnte?

Besten Dank

_________________
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 12.05.05 16:29 
Hallo

du zeichnest das Bitmap aber auch im Suche in: Delphi-Forum, Delphi-Library ONPAINT der Paintbox, damit es bei erforderlichen Neuzeichnen (z.B. minimieren, Fensterüberlagerungen) neugezeichnet wird?
Ansonsten : poste etwas relavanten code.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Spatz Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Do 12.05.05 16:35 
ich zeichne das bitmap nur im onpaint und repainte die paintbox einfach immer... dies ist also nicht das problem. dass das bitmap leer ist, ist auch nicht der fall, denn wenn ich genau vor dem zeichnen des bipmaps auf diesem noch etwas hinzufüge, so wird auch dies nicht gezeichnet...

code werde ich morgen posten. hab gerade feierabend ;)

_________________
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 12.05.05 16:36 
verklimpert :oops:

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Spatz Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Fr 13.05.05 08:57 
so, der versprochene code:

zeichnungsprozedur:

ausblenden volle Höhe Delphi-Quelltext
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:
procedure TSZWaveScope.doPaint(const MOVEWITHTIMELINE: boolean = true);
  procedure drawEvents;
  var
    x: integer;
  begin
    with FPaintBox.Canvas do
      for x := 0 to High(FEvents) do
      begin
        LineColor := clBlack;
        MoveTo(FEvents[x].Left + (FEvents[x].Width div 2), FEvents[x].Top + FEvents[x].Height);
        LineTo(PenPos.X, PenPos.Y + 10);
        LineTo(PenPos.X + (getPosFromMS(FEvents[x].Pos) - PenPos.X), PenPos.Y);
        LineTo(PenPos.X, FEventBmp.Height);
      end;
  end;
begin
  inherited;

  Color   := FBGColor;

  with FPaintBox.Canvas do
  begin
    Pen.Style   := psSolid;
    Brush.Color := clyellow;//FBGColor;
    FillRect(Rect(0, 0, FPaintBox.Width, FPaintBox.Height));

    Draw(0, 0, FEventBmp);
    Draw(0, FEventBmp.Height, FTimeBmp);                     // BEI DIESEN BILDERN MACHT ER MIR PROBLEME...
    Draw(0, FEventBmp.Height + FTimeBmp.Height, FWaveBmp);

    Pen.Color := clRed;
    MoveTo(FPos, 0);
    LineTo(FPos, Height);
  end;

  drawEvents;

  if MOVEWITHTIMELINE and ((FPos - HorzScrollBar.Position) > (Width - SCROLLSPACE)) then
    HorzScrollBar.Position := FPos - (Width - SCROLLSPACE);
end;



und mein Thread der die zeichnungsmethode immer wieder aufruft:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TSZPlayer.Execute;
begin
  while true do
  begin
    if FStatus = psStarted then
    begin
      channel := BASS_StreamCreateFile(FALSE, PChar(FFilename), 0, 0, 0);

      BASS_ChannelPlay(channel, false);
      setPosition(FPos^);

      while (BASS_ChannelIsActive(Channel) = BASS_ACTIVE_PLAYING) and (FStatus = psStarted) do
      begin
        FPos^ := getPosition;
        FDoPaint;
        Sleep(200);
      end;
      FStatus := psStopped;
    end else if BASS_ChannelIsActive(Channel) = BASS_ACTIVE_PLAYING then
      BASS_ChannelStop(channel);
    Sleep(100);
  end;
end;


Falls ihr noch einige Methoden braucht, die ich hier jetzt nicht gepostet habe, dann fragt nur danach.

_________________
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Spatz Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

WIN 2k
D7E
BeitragVerfasst: Fr 13.05.05 12:14 
ok, hab es mittlerweile selbst lösen können. relativ simpel :?

anstatt der dopaint- Methode im thread, muss ich die repaintmethode der paintbox aufrufen und das onpaint ereignis abfangen und zur dopaint-methode leiten...

danke trotzdem

_________________
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.