Log In    |    Knowledge Base    |    4D Home
Tech Tip: Background pictures
Published On: September 24, 2003

Compatibility: All versions

Whether it is to comply with a corporate image or to make an interface friendlier or more informative, you may be required to use background pictures in your forms.

There are several ways to do so.

The first solution is to paste the picture as current background in all of the forms that require it. To do so, you just need to paste the picture in the page zero. If you use a JPEG picture type, you will then notice that Windows machines on which QuickTime is not installed cannot display that picture. Besides, using JPEG pictures is not recommended. It always requires 4D to decompress the picture in memory and this may significantly affect the performance of your database. If you paste a BMP picture in all your forms, you will quickly realize that the size of each form is significantly increased, and so is the structure file.

The solution that should come to mind first would be to use inherited forms. Therefore, only one picture needs to be pasted in the inherited form used by other forms. You may also want to switch pictures depending on which user is logged in, etc. Another solution is to import the picture into the Picture library and use its reference into your forms. To do that you just need to drag and drop the picture from the picture library in your form. A picture pasted in your form can be resized and displayed as truncated, scaled or replicated.
- Truncated: the picture will be displayed 'as is' area that you have defined.
- Scaled: the picture is scaled to match the area's size.
- Replicated: the picture is replicated as many times as needed to fill the area. This is often used to define a background such as the one displayed in the Structure window in the Design environment.

The last way would be to use a non-enterable picture variable located in the background of each form. or in the inherited form. When loading the form, you can then assign any picture to that variable. Since it is a variable, you can change its contents at any time and see the changes after the window has been redrawn.