请问如何解决
请问如何解决

解决方案 »

  1.   

    你是怎么在panel中添加窗体的。
      

  2.   

    new 了一个窗体。
    然后
    testFrm..TopLevel = false;
    testFrm.Dock = DockStyle.Fill;
    panel.Controls.Add(testFrm);
    testFrm.Show();
      

  3.   

    是否要用外面的 tooltip。不能用子窗体的?
      

  4.   

    Form2 f2 = new Form2();
    f2.TopLevel = false;
    f2.Visible = true;
    panel1.Controls.Add(f2);可以啊。
      

  5.   

    就是放在子窗体的Form2.designer.cs
    namespace WindowsFormsApplication1
    {
        partial class Form2
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows Form Designer generated code        /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.button1 = new System.Windows.Forms.Button();
                this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(28, 12);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 0;
                this.button1.Text = "button1";
                this.toolTip1.SetToolTip(this.button1, "123");
                this.button1.UseVisualStyleBackColor = true;
                // 
                // Form2
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(124, 45);
                this.Controls.Add(this.button1);
                this.Name = "Form2";
                this.Text = "Form2";
                this.ResumeLayout(false);        }        #endregion        private System.Windows.Forms.Button button1;
            private System.Windows.Forms.ToolTip toolTip1;
        }
    }Form1.designer.cs
    namespace WindowsFormsApplication1
    {
        partial class Form1
        {
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows Form Designer generated code        /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.panel1 = new System.Windows.Forms.Panel();
                this.SuspendLayout();
                // 
                // panel1
                // 
                this.panel1.Location = new System.Drawing.Point(12, 12);
                this.panel1.Name = "panel1";
                this.panel1.Size = new System.Drawing.Size(268, 242);
                this.panel1.TabIndex = 0;
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Controls.Add(this.panel1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.ResumeLayout(false);        }        #endregion        private System.Windows.Forms.Panel panel1;
        }
    }Form1.cs
    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 WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
                Form2 f2 = new Form2();
                f2.TopLevel = false;
                f2.Visible = true;
                panel1.Controls.Add(f2);
            }
        }
    }
      

  6.   

    我知道了。是我的问题。我用了个第三方的 SuperTooltip被这个坑了