Control.IsAccessible

I need to check if the WinForm C # window (FORM class) has been initialized and is waiting for user events. But I could not understand how this could be done.

Therefore, I had the idea to set the Control.IsAccessible Flag parameter of the form to true in the OnLoad event of the Windows form.

Now my question is: what is the source of the Control.IsAccessible Flag intended for? Or there is another solution for checking Winform initialization.

thanks for the help

+3
source share
2 answers

I don’t know what IsAccessible is for, but for the check you are doing you want Created

if(myForm.Created)
{
    //Do stuff
}

, SO, .

+1

Control.IsAccessible , .

myForm.Created, , .

Application.Idle, , .

:

public int Main(string[] args)
{
    Application.Idle += WaitUntilInitialized;
}

private void WaitUntilInitialized(object source, EventArgs e)
{
    // Avoid processing this method twice
    Application.Idle -= WaitUntilInitialized;

    // At this point, the UI is visible and waiting for user input.
    // Begin work here.
}
+3

Source: https://habr.com/ru/post/1744992/


All Articles