Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Sa 04.11.06 16:02 
Hallo!

Ich habe eine Timelinekomponente, abgeleitet von TScrollingWinControl. In dieser werden die Ereignisse durch Panels dargestellt (später einfacher Ereignisse wie Click, Move usw.).

Nun möchte ich aber darunter ein Raster anzeigen. Könnte man mit Bevels machen, klar. Ist aber bestimmt langsamer, oder?

Jedenfalls hab ich das gleiche Problem, wie dieses hier.

Das Canvas ist ein TControlCanvas.

Paintwindow wurde überschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
  FCanvas.Lock;
  try
    FCanvas.Handle := DC;
    try
      //löschen...theoretisch.
      FCanvas.Brush.Color:= clWhite;
      FCanvas.Brush.Style:= bsSolid;
      FCanvas.FillRect(InnerRect);
      PaintGrid;
    finally
      FCanvas.Handle := 0;
    end;
  finally
    FCanvas.Unlock;
  end;


Und die PaintGrid-proc:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TSynthTimeLine.PaintGrid;
var x,d:integer;
begin
  x:= 1;
  d:= T2X(1000);
  while x<HorzScrollBar.Range do begin
    FCanvas.MoveTo(x,0);
    FCanvas.LineTo(x,ClientHeight);
    inc(x,d);
  end;
end;


Interessanterweise scheint das Löschen vor dem Paintgrid nicht zu funktionieren. Warum?

Danke schonmal,
Sebastian

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."