private void UpdateControlRepositoreies() { ControlRepositories = new Dictionary <string, RepositoryItem>(); List <BaseEdit> editorList = EditorFinder.FindEditors(_drawControl); foreach (Control control in editorList) { BaseEdit editor = control as BaseEdit; if (editor == null) { continue; } ConstructorInfo cConstructor = editor.Properties.GetType().GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance | BindingFlags.NonPublic, null, new Type[] { }, null); RepositoryItem ri = cConstructor.Invoke(null) as RepositoryItem; if (!ControlRepositories.ContainsKey(ri.EditorTypeName)) { ControlRepositories.Add(ri.EditorTypeName, ri); } } }
public override void Draw(ControlGraphicsInfoArgs info) { base.Draw(info); CustomControlViewInfo vi = info.ViewInfo as CustomControlViewInfo; CustomRepositoryItem cri = vi.Item as CustomRepositoryItem; if (cri.ControlType == null) { return; } (cri.DrawControl as IEditValue).EditValue = vi.EditValue; cri.DrawControl.Bounds = info.Bounds; Bitmap bm = new Bitmap(info.Bounds.Width, info.Bounds.Height); cri.DrawControl.DrawToBitmap(bm, new Rectangle(0, 0, bm.Width, bm.Height)); info.Graphics.DrawImage(bm, info.Bounds.Location); List <BaseEdit> editors = new List <BaseEdit>(); editors = EditorFinder.FindEditors(cri.DrawControl); DrawEditors(editors, info, cri); }