VS2005中menustrip控件如何实现tabcontrol功能?

来源:百度知道 编辑:UC知道 时间:2024/06/16 21:41:20
就是用menustrip控件设置了三个文本分别是“网络游戏,单机游戏,聊天工具”而点网络游戏是一个窗体,点其他又是另个窗体,就像tabcontrol控件一样。

你可以用把Tabcontrol放在ToolStripControlHost这个容器里在把ToolStripControlHost作为Menustrip的菜单项放在Menustrip里,代码如下

//先在窗体上放一个menustrip添加一个菜单叫“娱乐”,不要改名默认的名就行,下面TabControl的代码是从设计器里拖出来的,你也可以自己写

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace Test

{

    public partial class Form10 : Form

    {

        private System.Windows.Forms.TabControl tabControl1;

        private System.Windows.Forms.TabPage tabPage1;

        private System.Windows.Forms.TabPage tabPage2;

        private System.Wind