I was thinking that WinForms are classes as any other classes. But starting f开发者_StackOverflow社区orm project get me confuse. Why new Form start with Application.Run and what kind of mechanism happen inside of it ?
As it says in the documentation, it begins running a standard application message loop on the current thread. The message loop handles clicks, keypresses, paint requests, plus many other things.
When called with a form as an argument it also makes that form visible.
This goes way back to the Win32 API. Winforms sits on top the win32 api. Application.Run() plugs your program into (implements) the win32 message loop. Pretty much all mouse and keyboard events (and most anything else initiated by the user) are really win32 messages.
精彩评论