Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Free Advertising Forums Directory > Miscellaneous Forums

Miscellaneous Forums This is a list of any forum that has a free advertising section but doesnt fit into the categories above.

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 05-13-2011, 07:21 PM   #1
tianxa76
 
Posts: n/a
Default Microsoft Office 2010 Pro Modal Dialogs with Trans

If you've taken a look at some web sites recently, you may have noticed an effect where items (usually images or videos) are brought to the foreground using an effect called a lightbox. The effect is used to dim (or sometimes lighten) the background of the active window while bringing another window to the foreground. The window in the foreground appears to have more prominence because the windows in the background have been dimmed or made transparent. Our friend Tim uses this on his site to display images of sports cards and it looks pretty cool.

Windows Vista uses this effect in a security feature called User Account Control. This feature provides prompts when launching a process with elevated privilege. In order to draw attention to the prompt, the desktop and other windows are dimmed which makes the elevation prompt stand out. Vista also places the machine in a "sandbox" of sorts so that you cannot interact with other portions of the UI. The solution presented here does not do this. Users will still be able to switch to other applications running at the time.

Now let's say that you want to do something like this to draw attention to a form in Access. There are a few places in an application where this might be interesting. For example:
Login dialog Image viewer About dialog User entry screen On screen help
As you can see, almost any case where you might use a modal form in an Access application might be a good candidate to add a lightbox effect. That said - the effect could feel a bit heavy handed after a while so you might not use it for all modal forms, but certainly for those that are more important than others.

You can add this effect to your Access applications with another form by adding transparency on the form window using the SetLayeredWindowAttributes and SetWindowLong Windows API functions. To start, create a new dialog form with the Modal property set to Yes. I used a Login type form called frmLogin as shown below:



Next, create a new form called frmTransparent where we will set transparency so that you can see through it. To set the appearance that the form is being dimmed, change the following properties of frmTransparent.
Set the BackColor property of the Detail section to black (#000000 in Access 2007) Set the BorderStyle property of the form to None to remove the border. Set the RecordSelectors property to No Lastly, set the Popup property to Yes.
Now that the forms are created, it's time to add some code. Start by creating a new module called Module1. In the module, add the following code:

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  (ByVal hwnd As Long, _
   ByVal nIndex As Long,Office Pro, _
   ByVal dwNewLong As Long) As Long

Private Declare Function SetLayeredWindowAttributes Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal crKey As Long, _
   ByVal bAlpha As Byte, _
   ByVal dwFlags As Long) As Long

Private Const LWA_ALPHA     As Long = &H2
Private Const GWL_EXSTYLE   As Long = -20
Private Const WS_EX_LAYERED As Long = &H80000

Public Sub SetFormOpacity(frm As Form, sngOpacity As Single)
    Dim lngStyle As Long

    ' get the current window style, then set transparency
    lngStyle = GetWindowLong(frm.hwnd,Office 2010 Product Key, GWL_EXSTYLE)
    SetWindowLong frm.hwnd, GWL_EXSTYLE, lngStyle Or WS_EX_LAYERED
    SetLayeredWindowAttributes frm.hwnd, 0, (sngOpacity * 255), LWA_ALPHA
End Sub

Next, in the code behind the frmTransparent form, add the following code to the Resize event of the form. Using this code in the Resize event seems to reduce some of the flicker seen with other events such as Open and Load.

Private Sub Form_Resize()
    Me.Painting = False
    DoCmd.Maximize
    SetFormOpacity Me, 0.7
    Me.Painting = True
End Sub

Now, add the following code to the Load and Unload events of the login dialog form. This will open the transparent form when the dialog form opens, and close it when the dialog form closes.

Private Const CON_TRANSPARENT_FORM As String = "frmTransparent"

Private Sub Form_Load()
    With DoCmd
        .Echo False
        .OpenForm CON_TRANSPARENT_FORM
        .Echo True
    End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If (CurrentProject.AllForms(CON_TRANSPARENT_FORM).IsL oaded) Then
        DoCmd.Close acForm, CON_TRANSPARENT_FORM
    End If
End Sub

To test this, open the login dialog form which will subsequently open the transparent form. The transparency form appears dimmed which makes the login form stand out.



With the API functions created,Microsoft Office 2010 Pro, there are some ways you might extend this in the future. For example,Windows 7 Serial, try experimenting with a background color other than #000000, or different values of opacity.

Enjoy,Office 2007 Product Key!
<div
  Reply With Quote
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:02 PM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum