?
Solved

Convert Panel To Bitmap

Posted on 2002-05-19
19
Medium Priority
?
901 Views
Last Modified: 2010-04-04
Hello

How can I Convert Panel to Bitmap image whan the panel that I want to convert is INVISIBLE,
and all of the control's have to be coped.

Thank you.
0
Comment
Question by:S_Warrior
[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
  • 7
  • 6
  • 6
19 Comments
 
LVL 9

Expert Comment

by:ginsonic
ID: 7019753
I think that you can't .
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7019757
In case that you understand through Invisible that the Visible:=False.
0
 

Author Comment

by:S_Warrior
ID: 7020985
yes if Visible := False or just some other windows is hidding the panel.
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 9

Expert Comment

by:ginsonic
ID: 7021361
In this case you can't do this job .
0
 

Expert Comment

by:Farderlorn
ID: 7024031
If it is a panel of your application, you can do the following:

procedure TForm1.Button1Click(Sender: TObject);
var bmp1,bmp2 : tbitmap;
begin
  bmp1 := TBitMap.Create;

  //Show the panel (you will not really see it, it's too fast)
  panel1.Show;

  //Get the image of the entire form, which contains the panel
  bmp1 := GetFormImage;

  //after this hide the panel
  panel1.Hide;

  //create and prepare the destination bitmap
  bmp2 := TBitMap.Create;
  bmp2.Width := panel1.Width;
  bmp2.Height := panel1.Height;

  //copy only the part of panel from the "FormImage" in bmp1
  BitBlt(bmp2.Canvas.Handle,0,0,panel1.Width,panel1.Height,bmp1.Canvas.Handle,panel1.Left,panel1.Top,srccopy);

  //save it....or do somthing else
  bmp2.SaveToFile('MyFile.bmp');


  bmp1.Free;
  bmp2.Free;
end;
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7026243
Nice trick, Farderlorn :)
0
 

Author Comment

by:S_Warrior
ID: 7029413
yes nice trick but it don't help me.

my real probleam is that the panel is hidden under anther panel so I can't play with the hide and show function's

also I already tred every trix's there is I realy need to find some why to do that without doing any cheap trix.
0
 

Expert Comment

by:Farderlorn
ID: 7029442
Is it your application?

If so, why you can't hide all these panels and do the trick ?

And if it isn't yours, catch the handles of the panels and you can also do it.

You have to explain your problem much more, so we don't "waste" time by trying to solve problems, that not exist.
0
 

Author Comment

by:S_Warrior
ID: 7029815
its my application,

I have object's that I load from File and into a panel,

now the panel is a small preview window in a Open dialog, I can't resize or hide the preview window.

and the panel where I am loading objects its very big, so I want to convert it into image and make a strach option!
0
 

Author Comment

by:S_Warrior
ID: 7029816
and I already tried to move the panel and copy the rect parts and then make them 2gezer, but its flickering like I dont what.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7031255
If is anyway hidden , whay don't place it in a good position to capture the image ? In same time can be over.
0
 

Expert Comment

by:Farderlorn
ID: 7036604
Ok, think about this:

Put your or a special "Loading-panel" on an other form.
This form does not to visible on screen (Left := 2000), only visible in its options.
Then load the data or objects in this "Loading-panel".
Use the "Trick" with this new form and display the image you got.

 - Farderlorn
0
 

Expert Comment

by:Farderlorn
ID: 7036606
Ok, think about this:

Put your, or a special, "Loading-panel" on an other form.
This form HAS not to BE visible on screen (Left := 2000), only visible in its options.
Then load the data or objects in this "Loading-panel".
Use the "Trick" with this new form and display the image you got.

- Farderlorn
0
 

Author Comment

by:S_Warrior
ID: 7036863
I already tried this BitBlt don't copy the image unless it showen on screen.
0
 

Accepted Solution

by:
Farderlorn earned 800 total points
ID: 7036900
BitBlt() has nothing to do with the "shown image", because in the example, i called "Trick", it copies only one BMP to an other, and GetFormImage also works, if the form is not visible on screen, but visible by its options.

Try this, it works fine on my Delphi 6.

One form and one button.

procedure TForm1.Button1Click(Sender: TObject);
var bmp : tbitmap;
begin
 form1.Visible := true;
 form1.Left := 2000;

 ShowMessage('The form is not visible on screen now.
              I will get its image now.');

 bmp := TBitMap.Create;

 //Get the image of the entire form
 bmp := GetFormImage;

 //save it....or do somthing else
 bmp.SaveToFile('MyFile.bmp');

 bmp.Free;
end;
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7038496
//This form HAS not to BE visible on screen (Left := 2000),

What's happening if use two or more monitors ?

Better Top:=2000; // or more

Just a suggestion ;)
0
 

Expert Comment

by:Farderlorn
ID: 7038558
I think this is not really a problem...

You can calculate the "Left" in code.
Check the monitor(s), set "Left".

;-)
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7038716
To complicated for me , a Top:=2500 is the short solution .Just a joke :P
Anyway, I belive that your solution is the right answer.
0
 

Author Comment

by:S_Warrior
ID: 7041104
EXCELLENT ANSWER.

Thank you very much!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
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…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 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