c# - How to implement a-form-inside-a-form with runtime embedded forms switching? -
i need implement tabcontrol-like behaviour manual (on event, on button click example) pages switching , having pages designed , implemented separate forms. form incorporated (as panel control) inside main form , replaced form needed.
how achieve this?
ps: reason why don't want use tabcontrol instead because there going many tabs - i'd prefer present list of them treeview , instantiate on demand. reason comes project of mine - there going implement plug-ins, panel inside main window provided class loaded dynamically , runtime-switchable.
i did similar thing once, , reason, have replacecontrol method, paste below:
static public void replacecontrol(control toreplace, form replacewith) { replacewith.toplevel=false; replacewith.formborderstyle=formborderstyle.none; replacewith.show(); replacewith.anchor=toreplace.anchor; replacewith.dock=toreplace.dock; replacewith.font=toreplace.font; replacewith.size=toreplace.size; replacewith.location=toreplace.location; toreplace.parent.controls.add(replacewith); toreplace.visible=false; }
only thing left create control manually on form, placeholder form. use label, example.
Comments
Post a Comment