简体   繁体   English

VS2010自定义设置类编辑器

[英]VS2010 Custom Settings Class Editor

I have a custom settings class (inheriting from ApplicationSettingsBase) and I wish to replicate the functionality of showing a control for the editing of that class. 我有一个自定义设置类(从ApplicationSettingsBase继承),并且我希望复制显示用于编辑该类的控件的功能。 How do I do this, as I can't find anywhere that will show me? 我找不到适合我的地方,该怎么办?

I have spent a long time searching but I apologise if the solution is already out there. 我已经花了很长时间进行搜索,但是如果解决方案已经存在,我深表歉意。

Ed 埃德

What I do when I want to edit my custom settings at run-time is use a PropertyGrid with the SelectedObject property set to the name of my class: 当我想在运行时编辑自定义设置时,我的工作是使用PropertyGrid并将SelectedObject属性设置为类的名称:

public class frmOptions
{
    CustomSettings MySettings = new CustomSettings();

    private frmOptions_Load(object sender, EventArgs e)
    {
        PropertyGrid1.SelectedObject = MySettings;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM