From Border (painted) disappears when I minimize form - help RRS feed

  • Question

  • Hey,

    I have a custom, borderless form. I have programmatically painted a form border and when I run the application, the form border is visible, however if I minimize the form and then bring the form back up again, the form border is no longer there. This is my code:

    #Region "Form border"
        Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
            Dim rect As New Rectangle(0, 0, Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)
            ControlPaint.DrawBorder(e.Graphics, New Rectangle(0, 0, Me.Width, Me.Height), Color.FromArgb(64, 64, 64), ButtonBorderStyle.Solid)
        End Sub
    #End Region 'Border gone when minimized?

    Thanks for any suggestions as to why this is!

    Saturday, October 28, 2017 6:46 PM


All replies