winform application master form

不打扰是莪最后的温柔 提交于 2019-12-07 17:55:48

问题


I was working on an application using asp.net and C# and It made it very easy to develop using the notion of Master Pages. now I am trying to develop a windows form application and I really need to have a master page here also. is there anything such as a master form ?

thank you


回答1:


to simulate master-pages in winform you could cretae a base form, create either a class that inherits from System.windows.Forms or simply add a new form to your project, add the common controls and then create any other form adding an "Inherited Form" select the base form created and that should work

http://www.akadia.com/services/dotnet_inherited_forms.html




回答2:


There really isn't anything baked-in within Winform that works like ASP.NET master pages.

The closest you can get is having template forms with holes to be filled with user controls. You can connect your controls to "services" instances of the main form represented as interfaces types so that you can react on actions taken on controls owned by the template.

Be warned though, this isn't trivial and you're likely to face some unexpected limitations. Winform might not be the best platform for your new application because of that.



来源:https://stackoverflow.com/questions/17803169/winform-application-master-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!