可以用Win32 函数SetParent()更改窗口的父窗口;下面先做个简单程序看一下是什么效果;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace setpdemo
{
public partial class Form1 : Form
{
Form2 frm2;
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
frm2 = new Form2();
frm2.Show();
}
private void button2_Click(object sender, EventArgs e)
{
SetParent(button3.Handle, frm2.Handle);
}
private void button3_Click(object sen