none
Panel flickers when pressing tab or alt keys

    Question

  • Hi all,

    I have two panels (without images) in the main form, when the program loads there is no problem, but if I press the "tab" or "alt" keys the 2 panels flicker but just once, if I press again the keys nothing happens.

    So far I tried:

     - Add the form's DoubleBuffered = True

     - Created my own panel using:

    Public Class MyPanel
        Inherits Panel
    
        Public Sub New()
            Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
            Me.SetStyle(ControlStyles.ResizeRedraw, True)
            Me.SetStyle(ControlStyles.UserPaint, True)
            Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
        End Sub
    End Class

    But nothing seems to work, any ideas?

    Thanks in advance.


    G.Waters

    Friday, April 21, 2017 11:17 PM

Answers

  • After lots of time making the form again, I noticed that I had this property in order to show the form in the working area correctly (since it's a borderless form), this was the cause:


    Protected Overrides ReadOnly Property CreateParams() As CreateParams
            Get
                Dim CP As CreateParams = MyBase.CreateParams
                CP.Style = &HA0000
                Return CP
            End Get
    End Property


    G.Waters

    Saturday, April 22, 2017 7:54 PM

All replies

  • Well, since no one contributes, I had to make the form again from scratch and for some reason flicker disappeared, so my conclusion is that the designer file ordered the elements in the wrong way :(

    G.Waters

    Saturday, April 22, 2017 1:15 AM
  • Hi George Waters,

    I've made a simple Form (DoubleBuffers=True) with two Panels and one TextBox is in each Panel.
    And added a Class "MyClass" that had the same code as you showed.

    No flickers on those Panels when I pressed [Ctrl] or [Alt].

    I suppose there are something that you have not described.e.g. what kind of controls are there in your Panels?
    Please explain more details.
    ____________
    Ashidacchi
    Saturday, April 22, 2017 1:32 AM
  • After lots of time making the form again, I noticed that I had this property in order to show the form in the working area correctly (since it's a borderless form), this was the cause:


    Protected Overrides ReadOnly Property CreateParams() As CreateParams
            Get
                Dim CP As CreateParams = MyBase.CreateParams
                CP.Style = &HA0000
                Return CP
            End Get
    End Property


    G.Waters

    Saturday, April 22, 2017 7:54 PM
  • Hi George,

    It seems that you have solved your issue by yourself, please remember to close your thread by marking your post as answer, it is very beneficial to the other communities who face the same issue.

    Thanks for your understanding.

    Best regards,

    Cherry Bu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 25, 2017 3:00 AM
    Moderator