社区
C#
帖子详情
TabControl和TreeView的综合使用问题
lightingstorm
2006-11-02 10:26:12
现在用TreeView实现页面的导航,页面内容的设计要使用TabControl,方便实现切换和布局调整。但是不想让TabControl的导航标签显示。就是说,不用也不显示TabControl的导航标签,只使用TreeView的导航功能。怎么办???
...全文
389
5
打赏
收藏
TabControl和TreeView的综合使用问题
现在用TreeView实现页面的导航,页面内容的设计要使用TabControl,方便实现切换和布局调整。但是不想让TabControl的导航标签显示。就是说,不用也不显示TabControl的导航标签,只使用TreeView的导航功能。怎么办???
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lovvver
2006-11-03
打赏
举报
回复
你做的导航,类似于向导那样的吗?
如果是的话,你可以尝试用MagicLibrary.dll里的WizardForm。
或者你可以到codeproject里找wizard方面的控件。
oolongTea
2006-11-03
打赏
举报
回复
还可按需添加和删除
tabControl1.Controls.Remove(tabPage1);
tabControl1.Controls.Add(tabPage1);
oolongTea
2006-11-03
打赏
举报
回复
另一种做法(头两句可不加)
//tabControl1.Top = tabControl1.Top - tabControl1.ItemSize.Height;
//tabControl1.Height = tabControl1.Height + tabControl1.ItemSize.Height;
tabControl1.Region = new Region(new RectangleF(tabPage1.Left, tabPage1.Top, tabPage1.Width, tabPage1.Height + tabControl1.ItemSize.Height));
oolongTea
2006-11-03
打赏
举报
回复
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Right;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(88, 0);
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(352, 304);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.label1);
this.tabPage1.Location = new System.Drawing.Point(4, 4);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(225, 280);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "tabPage1";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Location = new System.Drawing.Point(4, 4);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(325, 296);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "tabPage2";
//
// label1
//
this.label1.Location = new System.Drawing.Point(72, 88);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 32);
this.label1.TabIndex = 0;
this.label1.Text = "Page 1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(64, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(200, 32);
this.label2.TabIndex = 0;
this.label2.Text = "Page 2";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 80);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 24);
this.button1.TabIndex = 1;
this.button1.Text = "Page 1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(16, 120);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 24);
this.button2.TabIndex = 2;
this.button2.Text = "Page 2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(410, 296);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.tabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.Text = "Form1";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
tabControl1.SelectedIndex = 0;
}
private void button2_Click(object sender, System.EventArgs e)
{
tabControl1.SelectedIndex = 1;
}
}
}
北京的雾霾天
2006-11-02
打赏
举报
回复
TabControl不能做到不显示上面的按钮,要是想做到界面的动态切换,可以用动态加载Control或UserControl或没有边框的Form到主界面里来实现。
相关推荐
TabControl
重绘添加关闭按钮与
Treeview
导航(进销存系统UI)C#案例演示
SplitContainer的面板
使用
Treeview
导航
TabControl
重绘添加关闭按钮 本演示案例适用于进销存C/S架构设计UI时参考
treeview
与
tabControl
组合
使用
1.左边一个
treeview
,右边一个
tabcontrol
; 2.调整控件让tree在
tabcontrol
上,并让
treeview
压住tab页 3.将tab页的name设置成
treeview
的node text 4.AfterSelect写入如下代码 private void
treeView
1_AfterSelect(object sender,
TreeView
Eve...
关于winform窗口运用程序实现
treeview
和
tabControl
的动态显示
关于winform窗口运用程序实现
treeview
和
tabControl
的动态显示 这个示例中菜单
使用
控件
treeview
,数据是动态加载的。右边的标签页用的
tabControl
,通过改变tabpag实现切换效果。 之前网上找了很多方法,由于我的form是动态加载的。一直没法获取,最后在窗口中先初始化。再把form对象放到对象集合再遍历集合,通过form的name属性和
treeview
的text属...
TabControl
和
TreeView
导航
单击
TreeView
Item时显示内容的
TreeView
WpfDemo-master.zip
WPF中的自定义控件,包含
TabControl
,
Treeview
,ListBox等,
TabControl
实现标题整体化,可带下划线,分页带关闭按钮,ListView加入图片,插入CheckBox;
Treeview
添加图片功能
发帖
C#
C#
.NET技术 C#
复制链接
扫一扫
10.9w+
社区成员
64.2w+
社区内容
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
帖子事件
创建了帖子
2006-11-02 10:26
社区公告
让您成为最强悍的C#开发者