Author Topic: flickering solution  (Read 2405 times)

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
flickering solution
« on: May 03, 2017, 03:59:29 PM »
hello

i faced an annoying problem with my project

wich is  pictures and controls  flickering when loading the form

i found two solutions

1- set  DoubleBuffered to true in the form properties

2- put this code any where inside your form.vb

Code: [Select]
Protected Overrides ReadOnly Property CreateParams() As CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ExStyle = cp.ExStyle Or &H2000000
            Return cp
        End Get
    End Property 'CreateParams


the second solution worked great for me

and i also kept DoubleBuffered  true


i hope this can help others


« Last Edit: May 04, 2017, 02:12:10 AM by oqapsking »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: solution to solution flickering
« Reply #1 on: May 03, 2017, 04:55:39 PM »
Most of the AdvancedHMI controls use this code in a default constructor to limit flicker and allow transparent background:

Code: [Select]
    Public Sub New()
        MyBase.New

        '* reduce the flicker
        Me.SetStyle(System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer Or
                    System.Windows.Forms.ControlStyles.AllPaintingInWmPaint Or
                    System.Windows.Forms.ControlStyles.UserPaint Or
                    System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, True)

    End Sub

Phrog30

  • Guest
Re: solution to solution flickering
« Reply #2 on: May 03, 2017, 06:33:59 PM »
Funny, two posts about flickering in the same day.  Thanks for posting this Archie.

James