Note that Winforms does not allow child controls to actually be transparent. As others have posted a separate transparent window is possible - but messy to manage.
Cheap way
- drag all controls into one panel and make it the size of the window (easy change)
- When operating: Hide that panel. Use the panels .DrawToBitmap method to set form background image.
- show progress bar, do work with 'doevents,' hide it.
- clear background image, re-show panel.
A Better way:
Progress Class - Consumer
I will give you a Usercontrol I wrote and have used in many different programs that does exactly what you want. Here is a trivial consumer example, you can paste into a form's code (yes, it just makes a bunch of new buttons for no reason):
Public Class Form1
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End ''// use a flag if you would like a more graceful way to handle this.
End Sub
WithEvents ucProgress As New Progress ''// just doing it this way so I don''//t have to paste designer code.
Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Controls.Clear()
Controls.Add(ucProgress)
Me.ucProgress.pb.Visible = False
ucProgress.StartProgress()
Try
ucProgress.Message = "Starting up..."
Application.DoEvents()
Me.ucProgress.pb.Visible = True
Me.ucProgress.pb.Maximum = 21
Me.ucProgress.pb.Value = 0
For i As Integer = 0 To 20
Dim btn As New Button
btn.Top = +i * 3
btn.Left = i * 8
btn.Text = CStr(i)
btn.Enabled = False ''// ONLY HAVE TO DO FOR CTLS RIGHT ON MAIN FORM
ucProgress.EnabledStates.Add(btn, True) ''// ONLY HAVE TO DO FOR C
answered 2010-09-21T19:11:13.470