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/)
-   -   Prism BackGroundImage nur einmal (https://www.delphipraxis.net/72881-backgroundimage-nur-einmal.html)

Daniel B 8. Jul 2006 16:20


BackGroundImage nur einmal
 
Hi,

wenn man ein Image einfügt, dann wird die komplette Form damit ausgefüllt, kann man es nur einmal anzeigen und am besten noch die Position vorgeben? Ohne eine Image Komponente zu benutzen!

Christian S. 8. Jul 2006 19:07

Re: BackGroundImage nur einmal
 
Kannst Du das nicht einfach selber auf die Form zeichnen?

So in etwa:
Delphi-Quellcode:
type
  MainForm = class(System.Windows.Forms.Form)
  private
    FloadedImage : Image := nil;
  protected
    //...
    method OnPaint(e : PaintEventArgs); override;
  public
    //...
   
    property aImage : String read 'c:\test.jpg';
    property aImageX : Integer read 10;
    property aImageY : Integer read 10;
  end;
   

method MainForm.OnPaint(e : PaintEventArgs);
begin
  if FloadedImage = nil then
    FloadedImage := Image.FromFile(aImage);
   
  e.Graphics.DrawImage(FloadedImage, new Point(aImageX,aImageY));  
 
  inherited OnPaint(e);
end;
(Sorry für Chrome-Code, aber habe von Delphi die .NET-Personalities nicht installiert)


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:21 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