Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Image on a TcustomPanel

Posted on 2003-12-12
6
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
delphized earned 100 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

722 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