这三种密码有什么区别?
1.
Window a = new Window ();
a.Show (); // call show
Application b = new Application ();
b.Run (); // call without a2.
Window a = new Window ();
// do not call show
Application b = new Application ();
b.Run (a); // with a为什么两者都能正常工作?为什么还要这么做呢?
Window a = new Window ();
a.Show (); // call show and also call show bellow
Application b = new Application ();
b.Run (a); // with a发布于 2014-08-31 04:21:55
这两者基本上都是用于消息循环的,它是windows应用程序的核心,它处理窗口消息,如绘画、鼠标/kbd事件等。
如果您使用下面没有Application.Run的代码
Window a = new Window ();
a.Show ();您会发现一个冻结的窗口,原因是没有人告诉该窗口重新绘制或处理任何事件。
因此,通过通过Application.Run调用消息循环,窗口开始按预期工作。
Application b = new Application ();
b.Run (a); // with ahttps://stackoverflow.com/questions/25588726
复制相似问题