none
Task bar icon is blinking when using multiple forms(custom inherited from MS form) RRS feed

  • Question

  • I have multiple child forms in my application, when I drag the one of the child form, focus is changed from mainform to child form which hidden in taskbar using ShowInTaskBar property as false. But taskbar icon is in unselected state when drag child form. Due to repeatedly focus changing  from child form to mainform which cause taskbar icon blinking. Please find the attached video for more details. 

    Child form Code

      childform = new Form();
                childform.ShowInTaskbar = false;
                childform.FormBorderStyle = FormBorderStyle.None;
                childform.TransparencyKey = childform.BackColor;
                childform.StartPosition = FormStartPosition.Manual;
                childform.TopMost = true;
                childform.Paint += new PaintEventHandler(OnPaint);


    Video : Flickering video

    How to avoid the task bar icon blinking(changing from focused state to unselected state).

    Thanks

    Magi


    • Edited by Magi02 Wednesday, August 21, 2019 6:26 AM
    Wednesday, August 21, 2019 5:38 AM

Answers

  • Hi Kyle,

    Did you mean that I need to set mainform as owner to the childform?

    childform.Owner =mainform;

    Thanks,

    Magi

    Right! In my test, it works.

        private void button1_Click(object sender, EventArgs e)
        {
            childform child = new childform();
            child.Owner = this;
            child.ShowInTaskbar = false;
            child.StartPosition = FormStartPosition.Manual;
            child.TopMost = true;
            child.Show();
        }

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 21, 2019 7:13 AM
    Moderator

All replies

  • Hi Magi02,

    Just add the following code.

        childform.Owner = this;

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 21, 2019 6:58 AM
    Moderator
  • Hi Kyle,

    Did you mean that I need to set mainform as owner to the childform?

    childform.Owner =mainform;

    Thanks,

    Magi

    Wednesday, August 21, 2019 7:11 AM
  • Hi Kyle,

    Did you mean that I need to set mainform as owner to the childform?

    childform.Owner =mainform;

    Thanks,

    Magi

    Right! In my test, it works.

        private void button1_Click(object sender, EventArgs e)
        {
            childform child = new childform();
            child.Owner = this;
            child.ShowInTaskbar = false;
            child.StartPosition = FormStartPosition.Manual;
            child.TopMost = true;
            child.Show();
        }

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 21, 2019 7:13 AM
    Moderator
  • Hi Kyle,

    Thanks for your suggestion,

    I have tried above code but it does not works for me. However i tried add below code in wndproc of the child form which may fix the problem. But i dont know when do i pass this code(whcih message). Could please suggest  any workaround using below code or please suggest any Wndproc code to fiix the issue. Because i need to fix this issue in Wndproc level.

    if( m.Msg == 0x0084)
    			{
    				m.Result = (IntPtr) (- 1);
                }
    


     Thanks,

    Magi

    Wednesday, August 21, 2019 7:35 AM
  • Hi Magi02,

    I test my code in several PCs, it works normally. Here is the simple demo.

    https://1drv.ms/u/s!AqgLs2tdMyFNg3PYSMoFKanD5cES?e=mPeehc.

    Regards,

    Kyle


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 21, 2019 7:45 AM
    Moderator
  • Hi Kyle,

    Your solution works for me but in some cases, when i drag and move the child windows sometime mouse up event triggers without manually mouse up which leads terminate the dragging of child windows. Below message is triggered when move the child window.

    Child Window:

     m.msd == 0x0232

    Is there any other ways without changing the owner to fix the flickering issue

    Thanks,

    Magi

    Wednesday, August 21, 2019 10:50 AM