Solved

Image on a TcustomPanel

Posted on 2003-12-12
6
241 Views
Last Modified: 2010-04-05
Hi

I want to write a desktop component, which works as the windows desktop.
It's inherit from TCustomPanel that contain a Timage. This Image is the background.
The background is showing in design-time, but I cannot see it in run time.
Can you help me ? Can I write something in the Paint methode ?
Here is the code.

...
    FBkGround : TPicture;
    FImage : TImage;
...

constructor Tdesktop.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Self.DoubleBuffered:=True;
  if FBkGround=nil then FBkGround:=TPicture.Create;
  Fimage:=TImage.Create(Self);
  Fimage.Align:=alClient;
  Fimage.Stretch:=true;  
  FImage.Picture:=FBkGround;
  Fimage.Parent:=Self;
end;

procedure Tdesktop.SetBkGround(Value: TPicture);
begin
  FBkGround.Assign(Value);
  Fimage.Picture:=FBkGround;
end;
0
Comment
Question by:wwwbetyar
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:Russell Libby
ID: 9928638

Have you tried setting the Visible property for the FImage? (sorry, can't test at the moment).

Regards,
Russell

constructor Tdesktop.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Self.DoubleBuffered:=True;
  if FBkGround=nil then FBkGround:=TPicture.Create;
  Fimage:=TImage.Create(Self);
  Fimage.Align:=alClient;
  Fimage.Stretch:=true;  
  FImage.Picture:=FBkGround;
  Fimage.Parent:=Self;

  Fimage.Visible:=True; // <---

end;
0
 

Author Comment

by:wwwbetyar
ID: 9928751
It doesn't work.
0
 

Author Comment

by:wwwbetyar
ID: 9928778
I wrote a procedure

procedure Tdesktop.Start;
begin
  Fimage.Picture:=FBkGround;
end;

If I call this procedure from the code (not in the components) it works.
But I don't want to call any procedure to work...
Does it have any triks for aftershow ?
Or any good solve ?
0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 5

Accepted Solution

by:
delphized earned 50 total points
ID: 9936881
in your original code

 instead of  FImage.Picture:=FBkGround;
use:
 FImage.Picture.assign(FBkGround);

and I wouldn't use the separate tpicure variable FBkGround, use instead the FImage.picture property
 

0
 

Author Comment

by:wwwbetyar
ID: 9937146
Your solution, does not work, but here is a good :

constructor Tdesktop.Create(AOwner: TComponent);
begin
...
  FDrawing:=True;
...
End;

procedure Tdesktop.Paint;
begin
  inherited;
  If (FBkGround<>nil) and (FDrawing) then
  Begin
    FDrawing:=False;
    Fimage.Picture.Assign(FBkGround);
  End;
end;
0
 
LVL 5

Expert Comment

by:delphized
ID: 9938655
yes, the point is the assign statement as I told you.
You can't use := to copy an image
the fact that you don't want to repaint the picture is not mentioned in this question
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
drawing animated level bar based on numbers 3 97
Find and Replace Stream with 0s 8 62
Adoquery sql  left join does not work 25 90
update joined tables 2 46
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question