TransWikia.com

Call this.Hide() but the Form is still activated on Win10

Stack Overflow Asked by Jonney on December 23, 2021

I have a dropdown Form to show some tips by clicking a button. The codes work on Win7 and XP for many years but it has problem on Win10.

private void MyDropDownForm_Deactivate(object sender, EventArgs e)
    {                       
        Console.WriteLine("Form.ActiveForm.Name_b4Hide = " + Form.ActiveForm.Name);
        Console.WriteLine("base.Focused_b4Hide = " + base.Focused);
        this.Hide();
        Console.WriteLine("base.Focused_a4Hide = " + base.Focused);
        Console.WriteLine("Form.ActiveForm.Name_a4Hide = " + Form.ActiveForm.Name);                 
    }

On Win7, the debug window show:

Form.ActiveForm.Name_b4Hide = "MyDropDownForm"
base.Focused_b4Hide = true
base.Focused_a4Hide = false
Form.ActiveForm.Name_a4Hide = "MainForm"

But on Win10,the debug window show:

 Form.ActiveForm.Name_b4Hide = "MyDropDownForm"
 base.Focused_b4Hide = true
 base.Focused_a4Hide = true
 Form.ActiveForm.Name_a4Hide = "MyDropDownForm"

Why this.Hide() produces different results on win10 vs win7? How to force to de-activate the MyDropDownForm after calling this.Hide()?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP