Adding a semi transparent background to a frameless popup vb.net

Is it possible to load an image with opacity<1 behind a popup window?

I've been asked to remove the frame from the popup because i cant control alerts when the X button is pressed. However, if i choose not to show the frame, the popup will blend with the previous window.

What I have in mind is: when the button to load the popup is pressed, to also load an image that appears infront of the original widnow but behind the popup, and to give an interesting affect, the imagen should have an opacity<1 (kind of trasnparent.
The image being just a plain white square.

I've been suggested to play around with the gradient alpha but I don't know how yet, so the question is basicly how to load an image behind the popup with some transparency and fixed position?


Any code suggestions will be greatly appreaciated
popup.JPG
infogwsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Use code like this to disable the 'X' in the top right:
Public Class Form1

    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Const CS_NoClose As Integer = &H200
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ClassStyle = cp.ClassStyle Or CS_NoClose
            Return cp
        End Get
    End Property

End Class

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom BeckCommented:
It sounds like you are trying to create a screen effect over the original web page while the pop up is visible. You can do this with css and a div or in the case of ASP.NET, a Panel like this:

<asp:Panel ID="screen" runat="server" CssClass="screen" Visible="false"></asp:Panel>

The css whould look like this:

.screen
{
      position:fixed;
      z-index: 600;
      width:100%;
      height:100%;
      top:0px;
      left:0px;
    background-color: #333;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
    filter: alpha(opacity=80);
    opacity: 0.8;
}

Adjust the z-index to get the screen in between the web page and pop up.

VS will complain about the opacity css, but it all needs to be there to make it cross browser compatible.
0
infogwsAuthor Commented:
Idle_mind: Im going to try you suggestion right away. Is the effect I'm mentioning possible?

Btw, I'm using Visual Studio 2008, coding with visual basic.net. Its a desktop application.
0
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
The effect is possible...
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim overlay As New Form
        overlay.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        overlay.ShowInTaskbar = False
        overlay.BackColor = Color.White
        overlay.StartPosition = FormStartPosition.Manual
        overlay.Location = Me.Location
        overlay.Size = Me.Size
        overlay.Opacity = 0.5
        overlay.Show(Me)

        Dim f2 As New Form2
        f2.ShowDialog()

        overlay.Close()
    End Sub

End Class

Open in new window

0
infogwsAuthor Commented:
That kind of solved the problem, thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.