日期:2014-05-18  浏览次数:21046 次

c# 初学者问 界面设计: 谁能设计这样的界面?告诉我用那个控件
但单击按钮一时,在右边的框中显示内容;当单击按钮二时,在右边框中显示不同内容;以此类推。我是过了,在右边多用panel控件不行的呀,谁有别的办法。


------解决方案--------------------

this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(98, 42);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
// 
// panel1
// 
this.panel1.BackColor = System.Drawing.Color.Blue;
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 100);
this.panel1.TabIndex = 0;
this.panel1.Controls.Add(this.label1);
// 
// Com
// 
this.Controls.Add(this.panel1);

要加什么 自己代码控制动态添加
清除的话 this.Controls.Remove() 或者clear()
------解决方案--------------------
……

timeLabel1 = new WindowsControlLibrary3.TiemLabel();
------解决方案--------------------
C# code
#region 工具栏单击事件

        #region 表列表
        /// <summary>
        /// 表列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripButtonDb_Click(object sender, EventArgs e) {
            TToolStripButton.Enabled = !TToolStripButton.Enabled;

            DbTable db = new DbTable();
            db.Dock = DockStyle.Fill;
            this.TPanel.Controls.Clear();
            this.TPanel.Controls.Add(db);
            this.TopLevel = true;

            TToolStripButton.Enabled = !TToolStripButton.Enabled;
        }
        #endregion

        #region 登录页面
        /// <summary>
        /// 登录页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TToolStripButton_Click(object sender, EventArgs e) {
            TToolStripButton.Enabled = !TToolStripButton.Enabled;

            Db db = new Db();
            db.Finish += new Db.EventHandler(db_Finish);
            db.Dock = DockStyle.Fill;
            this.TPanel.Controls.Clear();
            this.TPanel.Controls.Add(db);
            this.TopLevel = true;

            TToolStripButton.Enabled = !TToolStripButton.Enabled;
        }
        #endregion

        #region 连接上数据库后
        /// <summary>
        /// 登录完成后
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void db_Finish(object sender, DbEventArgs e) {
            //显示当前数据库连接
            lbInfo.Text = string.Format("当前连接,{0}", e.UserInfo.ServerName);

            SqlManagement s = new SqlManagement();
            s.Dock = DockStyle.Fill;
            this.TPanel.Controls.Clear();
            this.TPanel.Controls.Add(s);
            this.TopLevel = true;
        }
        #endregion

        #region 生成代码
        /// <summary>
        /// 生成代码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripButtonCreate_Click(object sender, EventArgs e) {
            ToolStripButtonCreate.Enabled = !ToolStripButtonCreate.Enabled;

            DbCreate dbCreate = new DbCreate();
            dbCreate.Dock = DockStyle.Fill;
            this.TPanel.Controls.Clear();
            this.TPanel.Controls.Add(