Einzelnen Beitrag anzeigen

BLin4ik

Registriert seit: 23. Nov 2011
40 Beiträge
 
Delphi 5 Enterprise
 
#17

AW: Statisches BG in ScrollBox

  Alt 19. Feb 2014, 15:58
Naja ganz weglassen kann ich sie an der Stelle nicht, dann würde
es ja gar nicht gezeichnet werden.

Krieg das leider auch nicht so gewünscht hin.

Delphi-Quellcode:
procedure TMyScrollBox.Painting;
var
  FDrawHeight, FDrawWidth: Integer;
  Row, Column, xl, xt, xw, xh: Integer;
  xdl, xdt: Integer;
  xRect: TRect;
  i: integer;
  xhdl: Word;
begin
  if (FNHBitmap.width <> 0) and (FNHBitmap.Height <> 0) then
  begin
    xRect := ClientRect;
    FDrawHeight := xRect.Bottom - xRect.Top;
    FDrawWidth := xRect.Right - xRect.Left;
    xdl := (HorzScrollBar.Position mod FNHBitmap.Width);
    xdt := (VertScrollBar.Position mod FNHBitmap.Height);
    for Row := 0 to (FDrawHeight div FNHBitmap.Height) + 1 do
    begin
      for Column := 0 to (FDrawWidth div FNHBitmap.Width) + 1 do
      begin
        xl := Column * FNHBitmap.Width + xRect.Left - xdl;
        xt := Row * FNHBitmap.Height + xRect.Top - xdt;
        xw := FNHBitmap.Width;
        if (FDrawWidth - xl + xRect.Left) < xw then
          xw := (FDrawWidth - xl + xRect.Top);
        xh := FNHBitmap.Height;
        if (FDrawHeight - xt + xRect.Top) < xh then
          xh := (FDrawHeight - xt + xRect.Top);
      
        (*  FNHCanvas.CopyRect(
          Rect(xl, xt, xl + xw, xt + xh),
          FNHBitmap.Canvas,
          Rect(0, 0, xw, xh)*)

          

          // Kopiert immer gleichen Bereich und fügt ein
          FNHCanvas.CopyRect(
          Rect(0, 0, xw, xh),
          FNHBitmap.Canvas,
          Rect(0, 0, xw, xh)

        );
      end;
    end;
  end;
end;
Angehängte Dateien
Dateityp: 7z Project1.7z (3,12 MB, 1x aufgerufen)
  Mit Zitat antworten Zitat