Solved

Image on a TcustomPanel

Posted on 2003-12-12
6
242 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 68
Delphi XE10 Round Image 2 162
select query - oracle 16 100
TServerSocket - file via sendbuf or Text via sendtext ? 1 67
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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