How to auto save and auto load all properties in winforms C#? -
how auto save properties winforms when closed , auto load properties winforms when load ? c#
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.text; using system.windows.forms; using system.io; namespace scontrol { public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { (int = 0; < controls.count; i++) { system.xml.serialization.xmlserializer x = new system.xml.serialization.xmlserializer(typeof(controls[i])); stream stream = file.open("test.xml", filemode.create); x.serialize(stream, controls[i]); } } } }
your question little unclear, but
if require saving/loading of form layout have at
windows forms user settings in c#
if require saving/loading object/class have at
load , save objects xml using serialization
edit:
this show how persist settings form properties.
save , restore setings of .net form using xml
also have @ the application automation layer - using xml dynamically generate gui elements--forms , controls
all these guide in direction need go.
i think main objective here is
- figure out when save , when load, , store/retrieve these settings.
- are storing these settings per user? in database? in xml file?
- next need identify properties saving/restoring per control. simple location/size settings might not cut controls have various complexities (button, textbox, gridview, listview)
- now need figure out how iterate controls on form. buttons, textboxes, panels, controls in controls (controls in panels), , maybe user controls. can done using recursion.
- now need decide on structure of xml file (if opt use xml). should pretty tree structure, @ form, , controls, , controls, tree structure.
Comments
Post a Comment