用户控制事件 [英] User Control Event

查看:52
本文介绍了用户控制事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C#编写应用程序.此应用程序是Win窗体.
我以这种形式添加菜单条,然后从中添加新项和关闭子项.
我以这种形式添加了1个面板.

当我单击新菜单项时,将一个用户控件(UserControl1)添加到面板中.在该UserControl1中,有一个确定"按钮.
我希望在确定"按钮单击事件中向表单的同一面板添加另一个用户控件(UserControl2).

谁能给我解决方法.

谢谢!

I write application in C#.This application is Win forms.
I add menu strip in that form.Add new and close sub items in that from.
I add 1 panel in that form.

When I click new menu item one user control(UserControl1 ) add to panel.In that UserControl1 have one "Ok" botton.
I want that I want add another user control (UserControl2) to same panel of form in "Ok" button click event.

Can any one give me solution.

Thank You!

推荐答案

这不是火箭科学...

It ain''t rocket science...

class MyForm
{
   MyUserControl myUserControl = null;
  
   private void buttonClickEvent(object sender, EventArgs e)
   {
       myUserControl = new MyUserControl();
   }
}


这篇关于用户控制事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆