how to avoid flicker in panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikram rawat
    New Member
    • Jun 2010
    • 5

    how to avoid flicker in panel

    when i open my form, my form flikers , which look odd.
    how can i overcome this problem?
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by vikram rawat
    when i open my form, my form flikers , which look odd.
    how can i overcome this problem?
    Its probably that you might be painting something in your form...

    You need to enabled the DoubleBuffered property of the control to reduce flickering...

    And in Panel you won't find such a property so.. you need to create a custom Panel...

    Create a custom Panel Contol (Custom Control)
    and put this code in the panel constructor
    Code:
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                    this.UpdateStyles();

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      when i open my form, my form flikers , which look odd.
      how can i overcome this problem?
      You're asking everyone to make a lot of assumptions and guesswork about your code. Please provide the code you are using for the constructor and the on_load event handler, so we can actually see what you are doing when the form is created and shown.

      Comment

      • vikram rawat
        New Member
        • Jun 2010
        • 5

        #4
        Originally posted by ThatThatGuy
        Its probably that you might be painting something in your form...

        You need to enabled the DoubleBuffered property of the control to reduce flickering...

        And in Panel you won't find such a property so.. you need to create a custom Panel...

        Create a custom Panel Contol (Custom Control)
        and put this code in the panel constructor
        Code:
                    this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                        this.UpdateStyles();
        I already done this, but it does not reslove my problem.can you give me a another suggestion for this?

        Comment

        • ThatThatGuy
          Recognized Expert Contributor
          • Jul 2009
          • 453

          #5
          Originally posted by vikram rawat
          when i open my form, my form flikers , which look odd.
          how can i overcome this problem?
          check your code in OnPaint() method ...

          You might be calling Invalidate() method inside OnPaint()..

          can you post your code

          Comment

          • GaryTexmo
            Recognized Expert Top Contributor
            • Jul 2009
            • 1501

            #6
            The other option might be that you're just trying to draw too much in your paint method. GDI+ isn't known for its speed so if this is the case you might need to explore other drawing options.

            That said, I'm with T and ThatThatGuy here. You need to either post some code or be more descriptive of what you're trying to do and what's going on.

            Comment

            • ThatThatGuy
              Recognized Expert Contributor
              • Jul 2009
              • 453

              #7
              Originally posted by vikram rawat
              when i open my form, my form flikers , which look odd.
              how can i overcome this problem?
              When using GDI+ Painting you need to be smart enough in handling all painting and drawing activities..

              BCoz if you don't then GDI can really be a headbump

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                OP doesn't want to provide code so we can actually help.
                Since I am not psychic, I'm unsubscribing from this thread.

                Comment

                Working...