Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 SplitContainer 右侧面板中有一个用户控件。在用户控件下方打开一个表单。现在,如果我单击用户控件中的按钮,则该当前表单应关闭并应打开一个新表单。这个怎么做?
您可以轻松地在您的应用中实现以下逻辑:
splitContainer.Panel2.Controls.Remove(myPanel); splitContainer.Panel2.Controls.Add(myOtherPanel);
这将从容器中移除现有面板并放置另一个面板。您可以扩展相同的逻辑来放置表单,或者轻松地在容器上分离控件。