vs2008+c#+winform自已有个 form1,怎么让这个form1成为用户控件?(用于splitContainer里的panel调用)小弟先感谢了!

解决方案 »

  1.   

    告诉你个简单的  你新建个 usercontrol 然后把代码 拷过去  这样就能 放到 panel里了
      

  2.   

    你可以把这个窗口的标题栏去了,把主窗口(存放form1的窗口)设置为MDI窗口
    然后再把form1添加进一个控件的Controls,我原来做过的,看是不是还要设置些什么反正这个是可以的当然一般来说用UserControl来做这些,用窗口也行,
      

  3.   

    form2内容:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;namespace WindowsFormsApplication5
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }
        }
    }
    新建控件内容:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;namespace WindowsFormsApplication5
    {
        /// <summary>
        /// UserControl1.xaml 的交互逻辑
        /// </summary>
        public partial class UserControl1 : UserControl
        {
            public UserControl1()
            {
                InitializeComponent();
            }
        }
    }
    把form2做成用户控件应该怎样写代码啊?
      

  4.   

    Form是顶级控件,不能加到其他容器中
      

  5.   

    为什么要用form?用其他的不行吗?
      

  6.   

    你就直接在工具栏上托一个自定义控件出来,放上你在Form1中的所有控件,在编译一次后,在把编好的控件拖出来用不是更方便吗?