Member Avatar for deletedaccount

Hi.

I am making a Anti-Virus (almost complete) however I would like to know how to make a custom 'Run As Administrator' dialog. Before you tell me this isn't possible, I do not mean I would like to replace the Windows 'Run As Administrator' dialog, I would just like to creare a form with the same appearance.

If you have ever used the latest version of Avast Anti-Virus, when you try to disable protection a window is shown, and the screen behind the form is locked the the brightness behind it goes down. That's a custom run as administrator window, but with they're form instead. Except, it's not the actual 'Run As Administrator' dialog from Windows. It's just been remade in their style for their application.

How would I go about doing this?

I have already designed my form. I just now need to know how to lock the screen, make it run in the center well I can do this from the properties window and how to change the brightness of screen down but keeping the form opacity 100% and normal brightness.

Thanks.

Recommended Answers

All 2 Replies

Create a fullscreen black form with low opacity and make it on top most then display your dialog above it.

Oussama is on the right path, you'll need to create 2 forms. One for your "screen dimming" and one for your dialog box.

FORM ONE properties:
"FormBorderStyle" = NONE
"WindowState" = MAXIMIZED
"Backcolor" = DESKTOP
"StartPosition" = CENTERSCREEN
"Opacity" = 85% (if setting property via code use a number between 0 - 1 [ex: 0.85])

FORM ONE CODE:

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Form2.Show()
End Sub

Since for one is our "screen dimmer" form two is going to be our actual form so we have to show it the same time we dim the screen.

--------------------------------------------

FORM TWO PROPERTIES:
"TOPMOST" = TRUE
"OPACITY" = 100%
"StartPosition" = CENTERSCREEN

FORM TWO CODE:

Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
    Form1.Close()
End Sub

This formclosing event makes form one close at the same time that form two closes so that way your "screen dimmer" is closed as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.