Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Flickering

Flickering

Scheduled Pinned Locked Moved C#
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kmuthuk
    wrote on last edited by
    #1

    Hi, Here is my code: Form_Leave() { this.Opacity = 0.5; } Form_Enter() { this.Opacity = 1; } If I have 10 controls in my form, I need to add this Form event handler to each and every controls in the form. And when I do that when Mouse_Leave and Mouse_Enter occur my form get flickering. Is there any other way to avoid flickering and adding event hander to each and every contol. Thanks in advance Muthu.

    Mircea PuiuM R D 3 Replies Last reply
    0
    • K kmuthuk

      Hi, Here is my code: Form_Leave() { this.Opacity = 0.5; } Form_Enter() { this.Opacity = 1; } If I have 10 controls in my form, I need to add this Form event handler to each and every controls in the form. And when I do that when Mouse_Leave and Mouse_Enter occur my form get flickering. Is there any other way to avoid flickering and adding event hander to each and every contol. Thanks in advance Muthu.

      Mircea PuiuM Offline
      Mircea PuiuM Offline
      Mircea Puiu
      wrote on last edited by
      #2

      Use SuspendLayout(), do what you have to do, ResumeLayout() (and eventually Refresh())

      SkyWalker

      K 1 Reply Last reply
      0
      • Mircea PuiuM Mircea Puiu

        Use SuspendLayout(), do what you have to do, ResumeLayout() (and eventually Refresh())

        SkyWalker

        K Offline
        K Offline
        kmuthuk
        wrote on last edited by
        #3

        I still have flickering even after using Suspend/Resume Layout. Thanks Muthu.

        1 Reply Last reply
        0
        • K kmuthuk

          Hi, Here is my code: Form_Leave() { this.Opacity = 0.5; } Form_Enter() { this.Opacity = 1; } If I have 10 controls in my form, I need to add this Form event handler to each and every controls in the form. And when I do that when Mouse_Leave and Mouse_Enter occur my form get flickering. Is there any other way to avoid flickering and adding event hander to each and every contol. Thanks in advance Muthu.

          R Offline
          R Offline
          Rob Graham
          wrote on last edited by
          #4

          rather than handling this with an event handler in each control, do it all in the main form's event handler:

          this.SuspendLayout();
          foreach( Control ctl in this.Controls)
          {
          ctl.opacity = x;
          }
          this.ResumeLayout();

          K 1 Reply Last reply
          0
          • R Rob Graham

            rather than handling this with an event handler in each control, do it all in the main form's event handler:

            this.SuspendLayout();
            foreach( Control ctl in this.Controls)
            {
            ctl.opacity = x;
            }
            this.ResumeLayout();

            K Offline
            K Offline
            kmuthuk
            wrote on last edited by
            #5

            Control doesn't have Opacity property!!! Thanks Muthu

            1 Reply Last reply
            0
            • K kmuthuk

              Hi, Here is my code: Form_Leave() { this.Opacity = 0.5; } Form_Enter() { this.Opacity = 1; } If I have 10 controls in my form, I need to add this Form event handler to each and every controls in the form. And when I do that when Mouse_Leave and Mouse_Enter occur my form get flickering. Is there any other way to avoid flickering and adding event hander to each and every contol. Thanks in advance Muthu.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Controls don't have Opacity properties. It applies to the Form, not it's controls. The entire form has to change its opacity, not the controls.

              Dave Kreskowiak Microsoft MVP - Visual Basic

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups