public static void CopyCtrl2ClipBoard(Control ctrl) { CBFormCtrl cbCtrl = new CBFormCtrl(ctrl); IDataObject ido = new DataObject(); ido.SetData(CBFormCtrl.Format.Name, true, cbCtrl); Clipboard.SetDataObject(ido, false); }
public static Control CloneCtrl(Control ctrl) { CBFormCtrl cbCtrl = new CBFormCtrl(ctrl); Control newCtrl = ControlFactory.CreateControl(cbCtrl.CtrlName, cbCtrl.PartialName); SetControlProperties(newCtrl, cbCtrl.PropertyList); foreach (Control child in ctrl.Controls) { newCtrl.Controls.Add(CloneCtrl(child)); } return(newCtrl); }
public static Control GetCtrlFromClipBoard() { Control ctrl = new Control(); IDataObject ido = Clipboard.GetDataObject(); if (ido.GetDataPresent(CBFormCtrl.Format.Name)) { CBFormCtrl cbCtrl = ido.GetData(CBFormCtrl.Format.Name) as CBFormCtrl; ctrl = ControlFactory.CreateControl(cbCtrl.CtrlName, cbCtrl.PartialName); ControlFactory.SetControlProperties(ctrl, cbCtrl.PropertyList); } return(ctrl); }