samedi 14 mars 2015

Unable to save dynamically modified properties of Drag and Dropped user controls

I am developing a small IDE in Windows Forms. This IDE contains a toolbox from which the controls are dragged and dropped to a panel. When dragged, only a text is transferred telling the panel about what type of user control must be created dynamically at the mouse position. The drag and drop function is working fine. After dragging and dropping the control, the panel will assign SelectedObject property of a PropertyGrid control with the control that is created. But the problem is that when I change the property in the PropertyGrid and try to save the properties in a text file, it saves the default property values, not the changed values. Following is how I am getting the properties of the user control:



List<FormFields> frms=new List<FormFields>();
UserControl uc = new MiniIDE.tControls.FormField("TextBox" + (getControlCount("FormField") + 1), "SampleText");
MiniIDE.tControls.FormField ff = ((MiniIDE.tControls.FormField)uc);
frms.Add(new FormFields()
{
name = ff.Name,
type = 0,
label=ff.LabelText,
value = ff.Value,
position_x=ff.Location.X,
position_y=ff.Location.Y
});


FormField is a user control. frms is a class that will hold the control properties.


Aucun commentaire:

Enregistrer un commentaire