Making TImage Ful Screen

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 10
Reputation: DOrmisher is an unknown quantity at this point 
Solved Threads: 0
DOrmisher DOrmisher is offline Offline
Newbie Poster

Making TImage Ful Screen

 
0
  #1
Mar 6th, 2008
I'm using Borland Builder C++ 6 (my tutors force me to) and I want to make a TImage full screen. I don't think there's any specific function for this, the only way I can see doing it is possibly manipulating the Height and Width properties, but then again I can't see it working unless I change the properties of form, panels etc.

Can someone please try and help me out?!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Making TImage Ful Screen

 
0
  #2
Mar 6th, 2008
There's nothing wrong with BC++Builder...

What do you mean "make a TImage full screen"? Do you have an image you want to resize to your desktop? Or do you mean that you have a form and you want the image area to grow with the form when you maximize (like MSPaint's image area does)? Does the image have an actual picture in it that must be preserved?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 10
Reputation: DOrmisher is an unknown quantity at this point 
Solved Threads: 0
DOrmisher DOrmisher is offline Offline
Newbie Poster

Re: Making TImage Ful Screen

 
0
  #3
Mar 7th, 2008
I'm making a program that loads a picture from a file into the TImage and reads all the other pictures in the directory of the file chosen into a TStringList then when a button is pressed it begins a slideshow, displaying the pictures from the directory in the TImage property at a user selected speed (using a timer). All this works fine, but now I need to implement a button that makes the picture loaded (and hence the slideshow) appear full screen. i.e. the whole of the monitors resolution is taken up by the TImage property. The slideshow need also to work when in 'full screen mode', and I'll probably want to use a keyHit to escape the full screen mode (most likely using a virtual key press).

Hope this is more understandable. And with regards to Borland...well I'm used to using Visual Studio and I find it a lot more user friendly!

Thanks
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Making TImage Ful Screen

 
0
  #4
Mar 7th, 2008
To make a form fullscreen and restore it you will have to manipulate your form using a couple of Win32 API functions.
#include <windows.h>

First, you'll need some class variables to preserve your form's normal attributes when it is fullscreen.
LONG f_form_style;
WINDOWPLACEMENT f_form_placement;
You'll also want to remember whether or not you are actually fullscreen.
bool f_is_fullscreen = false;

The following code snippit makes the window fullscreen. The variable handle is your form's hWnd.
  1. WINDOWPLACEMENT wp;
  2.  
  3. if (f_is_fullscreen) return;
  4.  
  5. f_form_style = SetWindowLong( handle, GWL_STYLE, 0 );
  6. f_form_placement.length = sizeof( WINDOWPLACEMENT );
  7. GetWindowPlacement( handle, &f_form_placement );
  8.  
  9. wp = f_form_placement;
  10. wp.showCmd = SW_SHOWMAXIMIZED;
  11.  
  12. SetWindowPlacement( handle, &wp );

To restore the window:
  1. SetWindowPlacement( handle, &f_form_placement );
  2. SetWindowLong( handle, GWL_STYLE, f_form_style );

As to the image, with Borland's TImage component, all you need to do is make sure that the AutoSize property is False and set the Stretch property to True. This will cause the image to stretch to fit the control's dimensions. That may distort it, so you will have to adjust the size of the control each time you assign a new bitmap to its Bitmap property to keep the aspect ratio correct.

So, if you have a form with a black or other neutral background with just a TImage on it, you can set the form to fullscreen. Then, to animate, just set a TTimer to assign the next image's bitmap to the form's TImage.picture.bitmap property, adjust the size so that at least two edges touch the form's edges, and you are all set.

Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Making TImage Ful Screen

 
0
  #5
Mar 7th, 2008
I forgot to set the value of f_is_fullscreen in the code snippits. Don't forget to do that...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 10
Reputation: DOrmisher is an unknown quantity at this point 
Solved Threads: 0
DOrmisher DOrmisher is offline Offline
Newbie Poster

Re: Making TImage Ful Screen

 
0
  #6
Mar 8th, 2008
Thanks dude you are awesome. Now there's actually a little bit of info on how to do something with a TImage on the net!
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 10
Reputation: DOrmisher is an unknown quantity at this point 
Solved Threads: 0
DOrmisher DOrmisher is offline Offline
Newbie Poster

Re: Making TImage Ful Screen

 
0
  #7
Mar 8th, 2008
Im actually a bit confused as to what to do with the handle variable, could you explain it a bit more? Do I need to get a value for the forms hWnd and then copy it to the handle variable?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 10
Reputation: DOrmisher is an unknown quantity at this point 
Solved Threads: 0
DOrmisher DOrmisher is offline Offline
Newbie Poster

Re: Making TImage Ful Screen

 
0
  #8
Mar 8th, 2008
Originally Posted by DOrmisher View Post
Im actually a bit confused as to what to do with the handle variable, could you explain it a bit more? Do I need to get a value for the forms hWnd and then copy it to the handle variable?

Actually mate I've just sorted it, cheers anyway!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC