473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,396 developers and data experts.

Simulate Full Screen or Dim the Background

92
In looking into transparent forms, I came across a rather simple solution to the "Run in Fullscreen" feature severely lacking in Access, adapted from the MSDN article at Modal Dialogs with Transparent Backgrounds (MSDN)

If you simply want a solid colour to fill the whole screen, make a form with that colour Detail and set:
- Scroolbars = Neither
- Record Selectors = No
- Navigation Buttons = No
- Dividing Lines = No
- Auto Resize = No
- Auto Centre = Yes
- Pop up = Yes
- Modal = No
- Border Style = None

If you want a picture, you'll need to make different size forms to fill different resolutions and open the relevant form.

In the form's VBA enter
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Resize()
  2.     Me.Painting = False
  3.     DoCmd.Maximize
  4.     Me.Painting = True
  5. End Sub
On the form that opens with the database, On Load enter:

Expand|Select|Wrap|Line Numbers
  1.     With DoCmd
  2.         .Echo False
  3.         .OpenForm <FormName>
  4.         .Echo True
  5.     End With
and On Close Enter:

Expand|Select|Wrap|Line Numbers
  1. If (CurrentProject.AllForms(<Form Name>).IsLoaded) Then
  2.         DoCmd.Close acForm, <Form Name>
  3. End If
This will fill the entire background of the screen and provided you set your other forms to Pop Up as well it will stay that way.

If you want to make it transparent for a dimming effect for errors or logins etc. add a module:

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" _
  2.   (ByVal hWnd As Long, _
  3.    ByVal nIndex As Long) As Long
  4.  
  5. Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" _
  6.   (ByVal hWnd As Long, _
  7.    ByVal nIndex As Long, _
  8.    ByVal dwNewLong As Long) As Long
  9.  
  10. Private Declare Function SetLayeredWindowAttributes Lib "User32" _
  11.   (ByVal hWnd As Long, _
  12.    ByVal crKey As Long, _
  13.    ByVal bAlpha As Byte, _
  14.    ByVal dwFlags As Long) As Long
  15.  
  16. Private Const LWA_ALPHA     As Long = &H2
  17. Private Const GWL_EXSTYLE   As Long = -20
  18. Private Const WS_EX_LAYERED As Long = &H80000
  19.  
  20. Public Sub SetFormOpacity(frm As Form, sngOpacity As Single)
  21.     Dim lngStyle As Long
  22.  
  23.     ' get the current window style, then set transparency
  24.     lngStyle = GetWindowLong(frm.hWnd, GWL_EXSTYLE)
  25.     SetWindowLong frm.hWnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED
  26.     SetLayeredWindowAttributes frm.hWnd, 0, (sngOpacity * 255), LWA_ALPHA
  27. End Sub
and change the resize sub on the background form to:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Resize()
  2.     Me.Painting = False
  3.     DoCmd.Maximize
  4.     SetFormOpacity Me, 0.7
  5.     Me.Painting = True
  6. End Sub

When combined with several dimming 'stages', forms can effectively fade in and out when opened and closed as well as becoming slightly transparent when they lose focus.
Note: To achieve a smooth fade, you need to remove all the Me.Painting = attributes.

When the forms have no borders, this can create a very nice floating form effect.
Apr 22 '10 #1
0 7027

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: pow67 | last post by:
Is there a javascript statement which can be incorporated in a hyperlink which will open a new page that fills the screen while leaving the page with the link open? Thanks in advance. CW
1
by: Nick Weekes | last post by:
Hi all, Is there any javascript function/s that will tell me if the current browser window is in full screen mode or not? I don't want to resize the window, just size content based on full...
3
by: Pat Sheen | last post by:
Is there some setting in Access so when I get help it will display full screen and not part screen with my Access window. I've Googled and checked help but can't find anything. Thanks Pat
6
by: Tony Liu | last post by:
Hi, when switched to the full screen mode in VS.NET IDE, is there any way to hide the main menu bar? Thanks Tony
9
by: Jensen bredal | last post by:
Is there any way i can view my web page in full screen mode? F11 still hhas the internet explorer tool bar. Many thanks in advance JB
0
by: Franklin M. Gauer III | last post by:
Hi, We have an application running that uses FULL SCREEN ANCHORING in Windows Forms. The application runs fine on all of our desktops and some laptops. We are having problems with certain Dell...
11
by: Richard | last post by:
Dear All, Does someone have a clue as to how you can get a form to show show itself "Full Screen"? Without Taskbar just a Form. Like Internet Explore if you press F11? Really need a solution...
7
by: MC felon | last post by:
i worked and compiled programs in code::blocks. These .exe's do not have full screen modes in them! how do i get them to work full screen?even properties of these exe's do not have full screen...
6
by: hdsk | last post by:
hi everybody, this is my first time posting something. And I'm sorry because my english is far from perfect. I'm trying to make a fullscreen transparent div but I have some restrictions on the way...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.