Controls Flickering?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Controls Flickering?
Dummy1912
Hello,

We have created our own controls and seems after run
we gets white flickering loading the forms

All our controls have the same code:
Code: Select all
Protected Overrides Sub OnCreateControl()
        MyBase.OnCreateControl()
        Try
            ParentForm.FormBorderStyle = FormBorderStyle.None
            ParentForm.AllowTransparency = False
            ParentForm.TransparencyKey = Color.Fuchsia
            ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
        Catch ex As Exception
        End Try
        DoubleBuffered = True
        Dock = DockStyle.Fill
        TabStop = False
        Invalidate()
    End Sub
Code: Select all
Sub New()
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
        Me.SetStyle(ControlStyles.ResizeRedraw, True)
        Me.SetStyle(ControlStyles.DoubleBuffer, True)
        SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
        Font = New Font("Segoe UI", 9)
    End Sub
anyone has a new solution please?

Thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Controls Flickering?
CodenStuff
I think you may get flickering no matter what you do and it also depends on how powerful the users machine is to how much flickering they get and how long it takes to load.

You could try using SuspendLayout() and ResumeLayout() property
https://msdn.microsoft.com/en-us/librar ... .110).aspx

or

BeginUpdate() and EndUpdate()
https://msdn.microsoft.com/en-us/librar ... .110).aspx

Those may help a little.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Controls Flickering?
Dummy1912
Hi again,

Well this don't work
Code: Select all
Me.SuspendLayout()
and this
Code: Select all
 .BeginUpdate()
my controls don't has this option :(

any other ideas :)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Controls Flickering?
Dummy1912
pfff what a night...

we have solved it
the flickering are less so its hard to tell :)
so happy

thanks codenstuff for the idea

solution:
added this on top of our class from the custom control
Code: Select all
    Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ExStyle = cp.ExStyle Or &H2000000
            Return cp
        End Get
    End Property
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
4 posts Page 1 of 1
Return to “Coding Help & Support”