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 form problem

Flickering form problem

Scheduled Pinned Locked Moved C#
winformscomhelpquestion
4 Posts 3 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.
  • S Offline
    S Offline
    SimpleData
    wrote on last edited by
    #1

    Hi I have created a graphically heavy windows forms application and when I minimize this application to system tray and bring it back, the form flickers for two seconds. Form contains over 5 transparent PNG images. I am using this code to minimize to tray:

    this.WindowState = FormWindowState.Minimized;
    this.ShowInTaskbar = false;
    TrayIcon.Visible = true;
    TrayIcon.ShowBalloonTip(2500, "GameSec hala çalışıyor!", "GameSec hala çalışmaktadır, tekrar görünür hale getirmek için tıklayın.", ToolTipIcon.Info);

    and this code to show it back:

    this.WindowState = FormWindowState.Normal;
    this.ShowInTaskbar = true;
    TrayIcon.Visible = false;

    I am aware that Hide() and Show() can be used in normal situations but it doesnt work for me because this form I am talking about is owned by another form. Here is a video that I've created for you to see the problem by yourself: http://www.youtube.com/watch?v=224IrASTu8E[^] Thanks in advance.

    H X 2 Replies Last reply
    0
    • S SimpleData

      Hi I have created a graphically heavy windows forms application and when I minimize this application to system tray and bring it back, the form flickers for two seconds. Form contains over 5 transparent PNG images. I am using this code to minimize to tray:

      this.WindowState = FormWindowState.Minimized;
      this.ShowInTaskbar = false;
      TrayIcon.Visible = true;
      TrayIcon.ShowBalloonTip(2500, "GameSec hala çalışıyor!", "GameSec hala çalışmaktadır, tekrar görünür hale getirmek için tıklayın.", ToolTipIcon.Info);

      and this code to show it back:

      this.WindowState = FormWindowState.Normal;
      this.ShowInTaskbar = true;
      TrayIcon.Visible = false;

      I am aware that Hide() and Show() can be used in normal situations but it doesnt work for me because this form I am talking about is owned by another form. Here is a video that I've created for you to see the problem by yourself: http://www.youtube.com/watch?v=224IrASTu8E[^] Thanks in advance.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      This article Flicker free drawing using GDI+ and C#[^] has some hints. Also if you are drawing on to panels, you can sub-class the standard panel, and just add the following to the constructor.

      		SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
      

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      1 Reply Last reply
      0
      • S SimpleData

        Hi I have created a graphically heavy windows forms application and when I minimize this application to system tray and bring it back, the form flickers for two seconds. Form contains over 5 transparent PNG images. I am using this code to minimize to tray:

        this.WindowState = FormWindowState.Minimized;
        this.ShowInTaskbar = false;
        TrayIcon.Visible = true;
        TrayIcon.ShowBalloonTip(2500, "GameSec hala çalışıyor!", "GameSec hala çalışmaktadır, tekrar görünür hale getirmek için tıklayın.", ToolTipIcon.Info);

        and this code to show it back:

        this.WindowState = FormWindowState.Normal;
        this.ShowInTaskbar = true;
        TrayIcon.Visible = false;

        I am aware that Hide() and Show() can be used in normal situations but it doesnt work for me because this form I am talking about is owned by another form. Here is a video that I've created for you to see the problem by yourself: http://www.youtube.com/watch?v=224IrASTu8E[^] Thanks in advance.

        X Offline
        X Offline
        Xmen Real
        wrote on last edited by
        #3

        I think thats normal 'coz GDI+ is slow. BTW did you notice something, when the form was flickring a magenta type color shown, I think you should change that color to gray or something similar to that form.

        TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

        ----------------------------------------------- 128 bit encrypted signature, crack if you can

        S 1 Reply Last reply
        0
        • X Xmen Real

          I think thats normal 'coz GDI+ is slow. BTW did you notice something, when the form was flickring a magenta type color shown, I think you should change that color to gray or something similar to that form.

          TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

          ----------------------------------------------- 128 bit encrypted signature, crack if you can

          S Offline
          S Offline
          SimpleData
          wrote on last edited by
          #4

          Thank you both for helping. I've solved the magenta-ish color problem but it's still flickering.

          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