Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   TScrollBox + TImage (https://www.delphipraxis.net/175711-tscrollbox-timage.html)

bernhard_LA 11. Jul 2013 13:02

TScrollBox + TImage
 
Ich möchte eine Preview Funktion für große Bilder relisieren und habe hierzu eine TImage in einer TScrollbox auf meinem Formular.

Die Idee : dbl-click auf Scroll Box sollte zwischen Stretch View des Bildes ohne Scroll Box und 1:1 View dies Bilders in einer Scroll Box mit entsprechenden Scrollbars umschalten ... der Code unten spielt noch nicht, was habe ich übersehen ?






Delphi-Quellcode:



Bild laden

  if Fileexists(testimgfile) then
    SourceImage.Picture.bitmap.LoadFromFile(testimgfile);
  ......


 
/// Zwischen zoom und Stretch view umschalten

procedure TFileSelectionForm.ScrollBox1DblClick(Sender: TObject);
begin
  Zoomed := not Zoomed;

  if Zoomed then
  begin
    SourceImage.AutoSize := false;
    SourceImage.Stretch := true;

  end
  else
  begin
    SourceImage.Stretch := false;
    SourceImage.AutoSize := true;
  end;
end;

Volker Z. 11. Jul 2013 16:14

AW: TScrollBox + TImage
 
Hallo,

versuche es doch mal so:
Delphi-Quellcode:
procedure TFileSelectionForm.SourceImageDblClick(Sender: TObject);
begin
  Zoomed := not Zoomed;

  SourceImage.AutoSize := not Zoomed;
  SourceImage.Stretch := Zoomed;
  if Zoomed then
    begin
      SourceImage.Width := ScrollBox1.Width;
      SourceImage.Height := ScrollBox1.Height
    end;

  ScrollBox1.AutoScroll := not Zoomed
end;
Gruß


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:57 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz