| | |
Making TImage Ful Screen
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 10
Reputation:
Solved Threads: 0
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?!
Can someone please try and help me out?!
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?
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?
•
•
Join Date: Mar 2008
Posts: 10
Reputation:
Solved Threads: 0
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
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
To make a form fullscreen and restore it you will have to manipulate your form using a couple of Win32 API functions.
First, you'll need some class variables to preserve your form's normal attributes when it is fullscreen.
You'll also want to remember whether or not you are actually fullscreen.
The following code snippit makes the window fullscreen. The variable
To restore the window:
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.
#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. C++ Syntax (Toggle Plain Text)
WINDOWPLACEMENT wp; if (f_is_fullscreen) return; f_form_style = SetWindowLong( handle, GWL_STYLE, 0 ); f_form_placement.length = sizeof( WINDOWPLACEMENT ); GetWindowPlacement( handle, &f_form_placement ); wp = f_form_placement; wp.showCmd = SW_SHOWMAXIMIZED; SetWindowPlacement( handle, &wp );
To restore the window:
C++ Syntax (Toggle Plain Text)
SetWindowPlacement( handle, &f_form_placement ); 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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: unable to return values from function in c++
- Next Thread: Search A String for proper format
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class code coding compile console conversion count data database delete deploy desktop developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






