rt
适时显示的意思是在不同的时候可以显示不同的内容,其他内容应该就是隐藏了
不知道能不能说的清楚,最近做毕设,很郁闷,对c#了解太少

解决方案 »

  1.   

    是不是早某个时间一些控件隐藏,一些显示?用Timer就可以
      

  2.   

    private void timer1_tick(.......)
    {
      timer.interval=10000;//10miao 
      TextBox t=new TextBox();
      t.Parent=this;
      t.left=100;
      t.right=200;
    }
    private void Form1_MouseDown(...........)
    {
      timer1.start();
    }
    private void Form1_MouseUp(.....)
    {
      timer1.Stop();
    }
      

  3.   

    做作业!using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            /// <summary>
            /// 必需的设计器变量。
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// 清理所有正在使用的资源。
            /// </summary>
            /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows 窗体设计器生成的代码        /// <summary>
            /// 设计器支持所需的方法 - 不要
            /// 使用代码编辑器修改此方法的内容。
            /// </summary>
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.richTextBox1 = new System.Windows.Forms.RichTextBox();
                this.button1 = new System.Windows.Forms.Button();
                this.richTextBox2 = new System.Windows.Forms.RichTextBox();
                this.timer1 = new System.Windows.Forms.Timer(this.components);
                this.SuspendLayout();
                // 
                // richTextBox1
                // 
                this.richTextBox1.Location = new System.Drawing.Point(39, 32);
                this.richTextBox1.Name = "richTextBox1";
                this.richTextBox1.Size = new System.Drawing.Size(207, 64);
                this.richTextBox1.TabIndex = 0;
                this.richTextBox1.Text = "";
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(100, 202);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 1;
                this.button1.Text = "button1";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // richTextBox2
                // 
                this.richTextBox2.Location = new System.Drawing.Point(39, 102);
                this.richTextBox2.Name = "richTextBox2";
                this.richTextBox2.Size = new System.Drawing.Size(207, 64);
                this.richTextBox2.TabIndex = 2;
                this.richTextBox2.Text = "";
                // 
                // timer1
                // 
                this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Controls.Add(this.richTextBox2);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.richTextBox1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.ResumeLayout(false);        }        #endregion        private System.Windows.Forms.RichTextBox richTextBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.RichTextBox richTextBox2;
            private System.Windows.Forms.Timer timer1;        public Form1()
            {
                InitializeComponent();
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                timer1.Interval = 1000;
                if (richTextBox1.Visible ==true)
                {
                    richTextBox1.Visible = false;
                    richTextBox2.Visible = true;
                }
                else if (richTextBox2.Visible == true)
                {
                    richTextBox1.Visible = true;
                    richTextBox2.Visible = false;
                }        }        private void Form1_Load(object sender, EventArgs e)
            {
                richTextBox1.Visible = true;
                richTextBox2.Visible = false;            
            }        private void button1_Click(object sender, EventArgs e)
            {
                timer1.Start();
            }    }
    }
      

  4.   

    这个是用MOUSE事件做的,如果是你要的结果,那么记得结贴using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace WindowsApplication1
    {
        public partial class Form1 : Form
        {
            /// <summary>
            /// 必需的设计器变量。
            /// </summary>
            private System.ComponentModel.IContainer components = null;        /// <summary>
            /// 清理所有正在使用的资源。
            /// </summary>
            /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }        #region Windows 窗体设计器生成的代码        /// <summary>
            /// 设计器支持所需的方法 - 不要
            /// 使用代码编辑器修改此方法的内容。
            /// </summary>
            private void InitializeComponent()
            {
                this.components = new System.ComponentModel.Container();
                this.richTextBox1 = new System.Windows.Forms.RichTextBox();
                this.button1 = new System.Windows.Forms.Button();
                this.richTextBox2 = new System.Windows.Forms.RichTextBox();
                this.timer1 = new System.Windows.Forms.Timer(this.components);
                this.SuspendLayout();
                // 
                // richTextBox1
                // 
                this.richTextBox1.Location = new System.Drawing.Point(39, 32);
                this.richTextBox1.Name = "richTextBox1";
                this.richTextBox1.Size = new System.Drawing.Size(207, 64);
                this.richTextBox1.TabIndex = 0;
                this.richTextBox1.Text = "";
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(100, 202);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(75, 23);
                this.button1.TabIndex = 1;
                this.button1.Text = "button1";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // richTextBox2
                // 
                this.richTextBox2.Location = new System.Drawing.Point(39, 102);
                this.richTextBox2.Name = "richTextBox2";
                this.richTextBox2.Size = new System.Drawing.Size(207, 64);
                this.richTextBox2.TabIndex = 2;
                this.richTextBox2.Text = "";
                // 
                // timer1
                // 
                this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Controls.Add(this.richTextBox2);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.richTextBox1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
                this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
                this.ResumeLayout(false);        }        #endregion        private System.Windows.Forms.RichTextBox richTextBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.RichTextBox richTextBox2;
            private System.Windows.Forms.Timer timer1;        public Form1()
            {
                InitializeComponent();
            }        private void timer1_Tick(object sender, EventArgs e)
            {
                timer1.Interval = 1000;
                if (richTextBox1.Visible ==true)
                {
                    richTextBox1.Visible = false;
                    richTextBox2.Visible = true;
                }
                else if (richTextBox2.Visible == true)
                {
                    richTextBox1.Visible = true;
                    richTextBox2.Visible = false;
                }        }        private void Form1_Load(object sender, EventArgs e)
            {
                richTextBox1.Visible = true;
                richTextBox2.Visible = false;            
            }        private void button1_Click(object sender, EventArgs e)
            {        }        private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                timer1.Start();
            }        private void Form1_MouseUp(object sender, MouseEventArgs e)
            {
                timer1.Stop();
            }    }
    }