Learn Microsoft Access Advanced Programming Techniques, Tips and Tricks.

Form Background with Gradient Color

Introduction

The Form background pictures are not only used for giving the Form a different look, but also for other useful purposes.

Assume that the user is entering data from a pre-printed document, such as a telephone bill or an electricity bill.  In such situations, it can be very effective to scan an image of the source document and use it as the background picture of the data entry form. The Data Fields can be positioned in appropriate locations on the image, matching the physical Document so that it will be easier for the user to find information on the Document and key in exactly the same locations on the Form.

Microsoft Access Form Wizard offers several images that can be used as background pictures, but I couldn’t find the one I wanted — a simple gradient background. So, I decided to create one myself and use it instead.


Creating a Sample Image

The steps are given below to create the image for the Form Background picture.

  1. Opened a new Microsoft Word Document and went through the following steps to create a Gradient bitmap image:

  2. Selected Format - - >Background - - > Fill Effects.

  3. Under Colors, options selected One Color.

  4. Clicked on the Color 1 drop-down control and selected a light color.

  5. Used the Darker/Lighter slider control to adjust the color tone.

  6. Selected the Horizontal Radio Button under Shading Styles.

  7. Clicked on one of the Style Variants.

  8. Clicked OK to apply the selected shade as the Background of the Word Document.

  9. Maximized the Word Document Window.

  10. Select the Prt Scrn key (at the top row, right side). The full-screen image is now captured and copied to the Clipboard.

  11. Opened the MS Paint Program. You can find this in Start -> Programs -> Accessories.

  12. Displayed the Toolbox (View -> Toolbox or press Ctrl+T).

  13. Selected the Select Tool (the one at the top right with a rectangle picture).

  14. Drawn a rectangle from the left top corner of the gradient image area to the right bottom corner to select the image large enough for my Form's width and height. If you find the width is not enough to cover your form, then change the Page Orientation of the Word Document into Landscape mode before capturing it in MS Paint.

  15. Use Ctrl+C to copy the selected area into the Clipboard.

  16. Clicked outside the selected area to deselect the earlier selection.

  17. Select Clear Image from the Image Menu (Ctrl+Shift+N) to clear the Canvas. Inspected the right Scroll Bar to check whether it is positioned at the top or not. It was positioned slightly down, so I dragged it up to the top. Similarly, adjusted the Scroll bar at the bottom to the position at the left end.

  18. Pressed Ctrl+V to paste the copied image from the Clipboard.

  19. Clicked outside the pasted image to deselect it.

  20. Dragged the Sizing control at the bottom of the Canvas up and stopped at the edge of the pasted image to eliminate the white area of the canvas.

  21. Similarly, adjust the right side of the image.

  22. Select Save from the File Menu to save the image with a name in a convenient location.

If you’ve been following along so far, we’re now ready to move on to the next stage — implementing the gradient image as a background picture. However, there are a few limitations when using images like this as a form background, but with a little trick, we can easily overcome them.

If you’re thinking about the increase in database size, you’re absolutely right to consider it. And if you’re already thinking about saving the image in JPEG or GIF format, then you’re one step ahead of me! Saving the image type as GIF in MS Paint won’t produce good-quality results. If you have access to software like Adobe Photoshop, you can create high-quality GIF images with much better control.

We’ll use the BMP image format with a few smart modifications to preserve excellent image quality without increasing the database size.

But first, let’s see how to apply the gradient image as the form’s background picture.

Inserting the Image on the Form Background

Before opening your database, you can check the current file size in Windows Explorer. It’s a good idea to compact the database first to get an accurate baseline size. After adding the background picture to a Form, inspect the database size again to see how much it has changed.

  1. Open your Database and open a Form in Design View or create a new one.

  2. Display the Property Sheet of the Form (View -> Properties).

  3. Find the Picture Property and click on it.

  4. Click on the build button (...) at the right side of the Property Sheet and click on it to browse to the location of the image you have saved and select the image.

  5. The next four Properties are used for formatting and displaying the Background Picture.

  • Picture Type
  • Picture Size Mode
  • Picture Alignment
  • Picture Tiling

Linked or Embedded Image Methods

The Picture Type property has two options, Embedded and Linkedwith Embedded as the default. The Embedded option allows opening the default image editor directly from within MS Access by double-clicking the image and editing the picture if needed. However, to support this functionality, Access stores not only the image but also additional information required to invoke the image editor. As a result, each embedded image can significantly increase the size of your database. Note that background images added this way cannot be edited by double-clicking them, unlike OLE object images inserted on a Form.

A better option is the Linked setting, which keeps the image stored externally, leaving your database size unaffected. However, in either case, the image file must remain available in the same location relative to your database if it is moved or shared.

The Picture Size Mode property provides three options. The default option, Clip, displays the picture at its actual size, positioned according to the Picture Alignment setting—Top Left, Top Right, Bottom Right, Bottom Left, Center, or Form Center. The Center option places the image both vertically and horizontally centered on the Form, while Form Center aligns it vertically centered along the left edge.

The Stretch/Zoom/Tile Picture Methods

The Stretch Picture Size Mode option will stretch the image to fit the dimensions of the Form, resulting in distortion of the image if it is a picture of something.

The Zoom Picture Size Mode option will attempt to maintain the right proportions of the image when stretched to match the dimensions of the Form. But both the Stretch and Zoom options will show stretch marks when the Form is restored to its original size. This is much evident when a .jpeg or GIF image is used.

The One Pixel Width Image

We can modify our earlier .bmp file to a one-pixel-width image and Tile it across the Form, which will give a good quality gradient picture effect, and the image size will also be small.

  1. Open the earlier saved .bmp image in the MS Paint Program.

  2. Select Attributes... from Image Menu.

  3. Change the Width value to 1, and no change in the Height value.

  4. Check Units selected are Pixels.

  5. Save the image with a different name.

  6. Change the name of the background image to the new image in the Picture property of the Form.

    Caution: Do not attempt to use the Picture Size Mode property options Stretch or Zoom; MS-Access may hang up.

  7. Set the Picture Tiling Property Value to Yes and save the Form.

  8. Open the Form in Normal View and enjoy your creation.

Share:

13 comments:

  1. I spent my Monday evening in geeky delight playing with these ideas.

    Very nice example of efficient use of the tools at hand!

    Two suggestions:
    1) Choose one of the dark-light-dark or light-dark-light options in Word. This way, if you make good choices on sizing and selecting, you can get seamless tiling for big forms.
    2) Use Paint attributes to downsize the canvas before copying the gradient image -- it will grow as needed, and this approach is much less aggravating than trying to manipulate sizing.

    PE in CT

    ReplyDelete
  2. I find it easier to create the same effect by photoshopping the image before adding it to the form background. I was looking for info about using an animated gif in a form background. Is this possibile?

    ReplyDelete
  3. I lately found your blog/website and have really loved reading this and some of your other posts. I believed I would dive out from the shadows and leave my very first comment. I'm not certain what to say other than I have enjoyed reading through and will continue to visit as frequently as I can.

    ReplyDelete
  4. Conveyancing Solicitors...

    [...]while the sites we link to below are completely unrelated to ours, we think they are worth a read, so have a look[...]...

    ReplyDelete
  5. Download Movies...

    [...]below you'll find the link to some sites that we think you should visit[...]...

    ReplyDelete
  6. Full Movie Downloads...

    [...]here are some links to sites that we link to because we think they are worth visiting[...]...

    ReplyDelete
  7. 1.) Extra Reading...

    2.) [...]this site is off topic but I recommend taking a quick look at it[...]...

    ReplyDelete
  8. Evil eye pendant...

    I saw this site and linked to it! Toataly recomended!...

    ReplyDelete
  9. 1.) What do you think...

    2.) [...]it would be cool if you took a look at this site. It has some good information on it[......]...

    ReplyDelete
  10. Blogging Internet...

    [...]we like to honor other sites on the web, even if they aren't related to us, by linking to them. Below are some sites worth checking out[...]...

    ReplyDelete
  11. OpenOffice Download...

    [...]listed below are several links to internet pages I always link to because we believe they really are worthy of browsing[...]...

    ReplyDelete
  12. Flash Website Builder It's An Incredible Posting Congratulations...

    Terrific story, reckoned I wish to track-back on it. FYI did you heard the news about the tsunami now has a lot more difficulties too :)...

    ReplyDelete
  13. nissan juke review...

    Awesome post, I've linked back to your blog here http://www.vwsuv.net/sites-we-like/ return the favor if you can, thanks!...

    ReplyDelete

Comments subject to moderation before publishing.

PRESENTATION: ACCESS USER GROUPS (EUROPE)

Translate

PageRank

Post Feed


Search

Popular Posts

Blog Archive

Powered by Blogger.

Labels

Forms Functions How Tos MS-Access Security Reports msaccess forms Animations msaccess animation Utilities msaccess controls Access and Internet MS-Access Scurity MS-Access and Internet Class Module External Links Queries Array msaccess reports Accesstips WithEvents msaccess tips Downloads Objects Menus and Toolbars Collection Object MsaccessLinks Process Controls Art Work Property msaccess How Tos Combo Boxes Dictionary Object ListView Control Query VBA msaccessQuery Calculation Event Graph Charts ImageList Control List Boxes TreeView Control Command Buttons Controls Data Emails and Alerts Form Custom Functions Custom Wizards DOS Commands Data Type Key Object Reference ms-access functions msaccess functions msaccess graphs msaccess reporttricks Command Button Report msaccess menus msaccessprocess security advanced Access Security Add Auto-Number Field Type Form Instances ImageList Item Macros Menus Nodes RaiseEvent Recordset Top Values Variables Wrapper Classes msaccess email progressmeter Access2007 Copy Excel Export Expression Fields Join Methods Microsoft Numbering System Records Security Split SubForm Table Tables Time Difference Utility WScript Workgroup database function msaccess wizards tutorial Access Emails and Alerts Access Fields Access How Tos Access Mail Merge Access2003 Accounting Year Action Animation Attachment Binary Numbers Bookmarks Budgeting ChDir Color Palette Common Controls Conditional Formatting Data Filtering Database Records Defining Pages Desktop Shortcuts Diagram Disk Dynamic Lookup Error Handler External Filter Formatting Groups Hexadecimal Numbers Import Labels List Logo Macro Mail Merge Main Form Memo Message Box Monitoring Octal Numbers Operating System Paste Primary-Key Product Rank Reading Remove Rich Text Sequence SetFocus Summary Tab-Page Union Query User Users Water-Mark Word automatically commands hyperlinks iSeries Date iif ms-access msaccess msaccess alerts pdf files reference restore switch text toolbar updating upload vba code