1
내 WinForms C# 응용 프로그램에서 설정 파일에 사용자 정의 클래스를 저장하려고합니다. 여기에 내 현재 코드 :설정 파일에서 사용자 정의 클래스 초기화
public class PanelSaver : ApplicationSettingsBase
{
private DockingStyle ds;
System.Drawing.Point location;
System.Drawing.Size panelSize;
[UserScopedSetting()]
[SettingsSerializeAs(System.Configuration.SettingsSerializeAs.Xml)]
public DockingStyle Style
{
get { return ds; }
set { ds = value; }
}
public System.Drawing.Point Location
{
get { return location; }
set { location = value; }
}
public System.Drawing.Size Size
{
get { return panelSize; }
set { panelSize = value; }
}
}
DockingStyle 변수는 DevExpress Dockpanels에서 제공됩니다. 여기
는 설정에서 사용되는 객체는 파일 :private void DockPanelSave(PanelSaver savingPanel, DockPanel realDockingPanel)//
{
try
{
savingPanel.Location = realDockingPanel.Location;
savingPanel.Size = realDockingPanel.Size;
savingPanel.Style = realDockingPanel.Dock;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
throw new NotSupportedException("You may have added a new panel, and may not have added a corresponding " +
"settings variable to hold it in the Settings.settings file");
}
}
내가 널을 얻을 :이 기능로 전달하여, 이러한 변수를 사용하려고
오류.
설정 파일의 값을 어떻게 초기화해야합니까? 나는 어떤 종류의 XML을 넣을 필요가 있다고 생각하지만 그것을 생성하는 올바른 단계를 모른다. 이 오류 또는 기타 이유로 내 null 오류가 인정 될 것입니다