Updating UI in .NET
In old MFC, there was an WM_IDLE event where you could examine the state of your program, and update menu items, buttons and the like accordingly to gray them out, add or delete options... This event was fired whenever the Windows message queue for your application became empty.
To mimic the same behaviour in .NET, you can build sort of an OnIdle event. First, the definition of the handler method, wich could go in the main form:
private void OnApplicationIdle(object sender, EventArgs e)
And then, registering that handler for the proper event. You can add the following at (for instance) the
Load event of the main form:System.Windows.Forms.Application.Idle += new EventHandler(OnApplicationIdle);
In
OnApplicationIdle it's up to you to check things (for instance, you can see whether there is any document open, and gray out the "Close" menu option if there isn't).
Si quies que traduzca un artículu (o parte) a una llingua, ponlo nos comentarios.
Si quieres que traduzca un artículo (o parte) a un idioma, ponlo en los comentarios.
Si tu veux que je traduise quelque article (ou part) en quelque langue, dites-le aux commentaires.
No hay comentarios:
Publicar un comentario