Delphi-PRAXiS
Seite 2 von 2     12   

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/)
-   -   Delphi Dynamische Scrollbox (https://www.delphipraxis.net/201317-dynamische-scrollbox.html)

EWeiss 23. Jul 2019 14:05

AW: Dynamische Scrollbox
 
Zitat:

Zitat von delphicoder123 (Beitrag 1437413)
Ich weiß nicht, wie das geht

Delphi-Quellcode:
image1.picture.bitmap.loadfromFile('Mein.bmp')


Die weite und höhe setzt sich dann automatisch abhängig vom eingeladenen Bitmap die brauchst du nicht zuweisen..
Wenn das Bitmap größer ist als der Viewport dann werden die Scroll Bars entsprechend sichtbar.

gruss

peterbelow 23. Jul 2019 14:12

AW: Dynamische Scrollbox
 
Zitat:

Zitat von delphicoder123 (Beitrag 1437409)
Was mache ich falsch?

Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    ScrollBox1: TScrollBox;
    Image1: TImage;
    procedure FormActivate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
  ScrollBox1.Align:=alClient;
  ScrollBox1.HorzScrollBar.Visible:=true;
  image1.Align:=alnone;
  image1.Left:=0;
  image1.Top:=0;
  image1.Stretch:=false;
  image1.center:=false;
  image1.Picture.Bitmap.Width:=900;
  image1.Picture.Bitmap.Height:=900;
  image1.Canvas.Rectangle(600,600,800,800);
end;

end.

https://community.idera.com/developer-tools/programming-languages/

Füge mal hinzu:

Delphi-Quellcode:
  image1.Width:=900;
  image1.Height:=900;

EWeiss 23. Jul 2019 14:14

AW: Dynamische Scrollbox
 
Zitat:

Füge mal hinzu:
Dann hat er immer noch kein Bild sondern ein leeres Image.
Die Image weite und höhe setzt sich entsprechend der Größe des eingeladenen Bitmaps.

gruss

peterbelow 23. Jul 2019 14:15

AW: Dynamische Scrollbox
 
Zitat:

Zitat von EWeiss (Beitrag 1437416)
Zitat:

Füge mal hinzu:
Dann hat er immer noch kein Bild sondern ein leeres Image.
Die Image weite und höhe setzt sich entsprechend der Größe des eingeladenen Bitmaps.

gruss

Er will das Image als Zeichenfläche benutzen, nicht um eine existierende Bitmap anzuzeigen.

EWeiss 23. Jul 2019 14:16

AW: Dynamische Scrollbox
 
Zitat:

Zitat von peterbelow (Beitrag 1437417)
Zitat:

Zitat von EWeiss (Beitrag 1437416)
Zitat:

Füge mal hinzu:
Dann hat er immer noch kein Bild sondern ein leeres Image.
Die Image weite und höhe setzt sich entsprechend der Größe des eingeladenen Bitmaps.

gruss

Er will das Image als Zeichenfläche benutzen, nicht um eine existierende Bitmap anzuzeigen.

Ok dann hast du recht ;)
Aber schaden tut es nicht das er jetzt weis wie man ein Bitmap einladen tut.
Und das er dann die weite und Höhe nicht selber setzen muss.

gruss

delphicoder123 23. Jul 2019 14:22

AW: Dynamische Scrollbox
 
Zitat:

Zitat von peterbelow (Beitrag 1437415)
Zitat:

Zitat von delphicoder123 (Beitrag 1437409)
Was mache ich falsch?

Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    ScrollBox1: TScrollBox;
    Image1: TImage;
    procedure FormActivate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormActivate(Sender: TObject);
begin
  ScrollBox1.Align:=alClient;
  ScrollBox1.HorzScrollBar.Visible:=true;
  image1.Align:=alnone;
  image1.Left:=0;
  image1.Top:=0;
  image1.Stretch:=false;
  image1.center:=false;
  image1.Picture.Bitmap.Width:=900;
  image1.Picture.Bitmap.Height:=900;
  image1.Canvas.Rectangle(600,600,800,800);
end;

end.

https://community.idera.com/developer-tools/programming-languages/

Füge mal hinzu:

Delphi-Quellcode:
  image1.Width:=900;
  image1.Height:=900;


Danke, euch beiden. Es hat geklappt.

Andreas L. 28. Jul 2019 14:29

AW: Dynamische Scrollbox
 
Zitat:

Zitat von delphicoder123 (Beitrag 1437409)
Was mache ich falsch?

Du musst noch die AutoSize-Property des Images setzen:

Delphi-Quellcode:
...

procedure TForm1.FormActivate(Sender: TObject);
begin
  ScrollBox1.Align:=alClient;
  ScrollBox1.HorzScrollBar.Visible:=true;
  image1.Align:=alnone;
  image1.Left:=0;
  image1.Top:=0;
  image1.Stretch:=false;
  image1.center:=false;
  image1.Picture.Bitmap.Width:=900;
  image1.Picture.Bitmap.Height:=900;
  image1.Canvas.Rectangle(600,600,800,800);

  // --> AutoSize setzen:
  image1.AutoSize := True;
end;

...


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:34 Uhr.
Seite 2 von 2     12   

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