Skip to content

Instantly share code, notes, and snippets.

@stmoerman
Created October 4, 2016 19:36
Show Gist options
  • Select an option

  • Save stmoerman/c0786ef95713db09ca391fe19dc18fc2 to your computer and use it in GitHub Desktop.

Select an option

Save stmoerman/c0786ef95713db09ca391fe19dc18fc2 to your computer and use it in GitHub Desktop.
Public Class InvisibleButton
Inherits Button
Private ShowMe As Boolean = True
Protected Overrides Sub OnPaint(ByVal pevent As System.Windows.Forms.PaintEventArgs)
If ShowMe Then
MyBase.OnPaint(pevent)
Else
pevent.Graphics.FillRectangle(New SolidBrush(Parent.BackColor), New Rectangle(0, 0, Width, Height))
End If
End Sub
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
ShowMe = Not ShowMe
Invalidate()
MyBase.OnClick(e)
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment