code that solved my proplem:
public class ButtonEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return
UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
IWindowsFormsEditorService editorservice = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
Complex_Editor form = new Complex_Editor();
ButtonProperties inobj = new ButtonProperties();
ButtonProperties outobj = new ButtonProperties();
List<neste> tempControls = new List<neste>();
bool textFlag, widthFlag, heightFlag;
textFlag = widthFlag = heightFlag = false;
if (context.Instance.GetType().Name == "Object[]")
{
object[] controls = (object[])context.Instance;
foreach (object control in controls)
{
neste temp = (neste)control;
tempControls.Add(temp);
}
for (int i = 0; i < tempControls.Count; i++)
{
if (tempControls[0].Button_Properties.Text != tempControls[i].Button_Properties.Text)
{
textFlag = false;
break;
}
textFlag = true;
}
for (int i = 0; i < tempControls.Count; i++)
{
if (tempControls[0].Button_Properties.Width != tempControls[i].Button_Properties.Width)
{
widthFlag = false;
break;
}
widthFlag = true;
}
for (int i = 0; i < tempControls.Count; i++)
{
if (tempControls[0].Button_Properties.Height != tempControls[i].Button_Properties.Height)
{
heightFlag = false;
break;
}
heightFlag = true;
}
if (textFlag)
inobj.Text = tempControls[0].Button_Properties.Text;
else
inobj.Text = "";
if (widthFlag)
inobj.Width = tempControls[0].Button_Properties.Width;
else
inobj.Width = 0;
if (heightFlag)
inobj.Height = tempControls[0].Button_Properties.Height;
else
inobj.Height = 0;
}
else
{
inobj = (ButtonProperties)value;
}
try
{
form.Controls["txtbxbtnText"].Text = inobj.Text;
}
catch
{
}
try
{
form.Controls["txtbxbtnWidth"].Text = inobj.Width.ToString();
}
catch
{
}
try
{
form.Controls["txtbxbtnHeight"].Text = inobj.Height.ToString();
}
catch
{
}
form.ShowDialog();
if (Variables.ValuesChanged == true)
{
if (!string.IsNullOrEmpty(form.Controls["txtbxbtnText"].Text))
{
outobj.Text = form.Controls["txtbxbtnText"].Text;
}
if (!string.IsNullOrEmpty(form.Controls["txtbxbtnWidth"].Text))
{
outobj.Width = int.Parse(form.Controls["txtbxbtnWidth"].Text);
}
if (!string.IsNullOrEmpty(form.Controls["txtbxbtnHeight"].Text))
{
outobj.Height = int.Parse(form.Controls["txtbxbtnHeight"].Text);
}
return outobj;
}
return base.EditValue(context, provider, value);
}
}</neste></neste>