Double Buffering in VB.NET

.net Panama
  • 14 years ago

    hello guys ... this is my first post here ...

    as far as i know ... the method of enabling double buffering in Visual Basic is ...

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True)
        Me.UpdateStyles()
    End Sub


     

    i have tried it ... but it is not working ... any suggestions please ?

    do we have to write a certain type of code ... or draw with a certain refresh rate ... to make double buffering effective ??

  • 14 years ago

    Hi,

    Try putting the code in the Form_Load event, like this:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or _
        ControlStyles.UserPaint Or _
        ControlStyles.DoubleBuffer, True)
    End Sub
    
    Good luck.
  • 14 years ago
    Try setting the form's DoubleBuffered property to True in the designer.

  • 14 years ago

    lexian,

    i have put the code in the LOAD event , but not working ...

     

     

  • 14 years ago

    jmcilhinney,

    the Form does not have any property by this name ...

    is there a certain way to enable it ??

  • 14 years ago

    any one to help ?

  • 14 years ago

    hammadmunawar wrote:

    jmcilhinney,

    the Form does not have any property by this name ...

    is there a certain way to enable it ??

    Yes there is.  Use .NET 2.0.  If you tell us what version you're using then we can avoid giving advice that isn't applicable.

  • 14 years ago
    i am using Visual Studio.NET  2003
  • 14 years ago

    any help plz ?

     

  • 14 years ago

    Hi hammad

    Put under form load event:

      'Stop the flicker
      me.SetStyle(ControlStyles.DoubleBuffer, true)
      me.SetStyle(ControlStyles.AllPaintingInWmPaint, true)

     

    Regards

    DoctorMahdi

  • 14 years ago

    Hi hammad

    Dog [&]Use this tip:

    Call SuspendLayout  to delay painting and ResumeLayout methods after everything is positioned correctly

    Regards

    DoctorMahdi

  • 14 years ago

    Here'e a link for double buffering

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter” - Eric Raymond