Einzelnen Beitrag anzeigen

flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#10

AW: How elimitnate flicker of Form on resizing?

  Alt 7. Feb 2018, 23:14
using my Doublebuffer.
Delphi-Quellcode:
function TForm1.DoubleBuffer(DC: HDC; width, height: Integer; Action: TAction): HDC;
begin

  if Action = CreateBuffer then
  begin
    FDBufferhDCTemp := CreateCompatibleDC(DC);
    FDBufferhBMTemp := CreateCompatibleBitmap(DC, width, height);
    FDBufferhBMPrev := SelectObject(FDBufferhDCTemp, FDBufferhBMTemp);
    FDBufferXx := width;
    FDBufferYy := height;
    FDBufferUseDC := DC;
    Result := FDBufferhDCTemp;
  end
  else
  begin
    // Zeichne das Resultat ins Target Window
    BitBlt(FDBufferUseDC, width, height, FDBufferXx, FDBufferYy, FDBufferhDCTemp, 0, 0, SRCCOPY);
    // Befreie die system resourcen
    SelectObject(FDBufferhDCTemp, FDBufferhBMPrev);
    DeleteObject(FDBufferhBMTemp);
    DeleteDC(FDBufferhDCTemp);
    Result := 0;
  end;
end;
and load as example
how do use it. see PaintBox1Paint

i am not use Doublebuffer from the Form it self.

greets


I not understood where use DC in my code

Delphi-Quellcode:
var
 DC: HDC;
 rc: TRect;
begin

rc := Form1.ClientRect;
DC := DoubleBuffer(Form1.Canvas.Handle, rc.Right, rc.Bottom, CreateBuffer);

// Where use this DC?

end;
and also want know if these parameters passed to this custom DoubleBuffer function are of my Form in my situation?
  Mit Zitat antworten Zitat