You can make a control invisible at runtime by having its code set its Visible property to False. For example, the following code shows how the InvisibleControl class works. Whenever it needs to draw itself, the control’s DrawControl method sets the control’s Visible property equal to its DesignMode property, so the control is visible at design time and hidden at runtime.
Public Class InvisibleControl Inherits Control Private Sub InvisibleControl_Paint(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint DrawControl(e.Graphics) End Sub Private Sub InvisibleControl_Resize(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Resize Me.Invalidate() End Sub Private Sub DrawControl(ByVal gr As Graphics) Me.Visible = Me.DesignMode gr.Clear(Me.BackColor) gr.DrawEllipse(New Pen(Me.ForeColor), _ 0, 0, _ Me.ClientRectangle.Width - 1, _ Me.ClientRectangle.Height - 1) End Sub End Class
If you want a control to be invisible at runtime, you should consider making it a component instead of a control. Components take fewer resources and don’t take up space on the form at design time. The only reason you should make a control invisible in this manner is if you want it to display some sort of complex data at design time that should be hidden from the user at runtime.