利用MagicLibrary控件实现类似VsNet平台界面
2007-04-19 17:01
525 查看
利用MagicLibrary控件实现VsNet平台界面:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//加入using语句
using Crownwood.Magic.Common;
using Crownwood.Magic.Docking;
namespace WindowsApplication3
...{
public partial class MainForm : Form
...{
//主窗口MainForm类里定义DockingManager对象
private DockingManager dockManager;
/**//*DockingManager的数据成员OuterControl,InnerControl用来决定DockingManager所在的窗口上哪些区域不受到DockingManager停靠窗口的影响
* Docking Manager不会影响在OuterControl对象以后加入主窗口的对象的窗口区域
* Docking Manager也不会影响在InnerControl对象以前加入主窗口的对象的窗口区域
*/
//构造函数里添加初始化代码
public MainForm()
...{
InitializeComponent();
//生成IDE风格的管理窗口
dockManager = new DockingManager(this, VisualStyle.IDE);
dockManager.OuterControl = statusStrip1;
dockManager.InnerControl = centerPanel;
centerPanel.IDEPixelBorder = true;
//生成Content对象,该对象是DockingManager管理的浮动窗口
Content solutionExplorerContent = new Content(dockManager);
//用Content对象包装要管理的窗口
solutionExplorerContent.Control = new solutionExplorer();
//设置停靠窗口属性
//获取"解决方案资源管理器"窗口的初始窗口尺寸
Size solutionExplorerSize = solutionExplorerContent.Control.Size;
//设置当停靠窗口收缩成标签时标签上的标题
solutionExplorerContent.Title = "解决方案资源管理器";
//设置停靠窗口展开时的标题
solutionExplorerContent.FullTitle = "解决方案资源管理器-Example";
//设置Content停靠窗口从标签状态滑动出来成为窗口状态时窗口大小
solutionExplorerContent.AutoHideSize = solutionExplorerSize;
//设置停靠窗口被“钉”在DockManager管理窗口上时的尺寸
solutionExplorerContent.DisplaySize = solutionExplorerSize;
//设定停靠窗口收缩时标签上显示的小图标,viewImgs是用户事先定义好的ImageList类型变量
solutionExplorerContent.ImageList = viewImgs;
solutionExplorerContent.ImageIndex = 0;
Content classViewContent = new Content(dockManager);
classViewContent.Control = new ClassView();
Size classViewSize = classViewContent.Control.Size;
classViewContent.Title = "类视图";
classViewContent.FullTitle = "类视图-Exam";
classViewContent.AutoHideSize = classViewSize;
classViewContent.DisplaySize = classViewSize;
classViewContent.ImageList = viewImgs;
classViewContent.ImageIndex = 1;
//设置浮动窗口的属性,title是窗口收缩以后的标题
//FullTitle是窗口显示时的标题
//将浮动窗口和具体在浮动窗口中被包含的面板联系起来
dockManager.Contents.Add(solutionExplorerContent);
//用AddContentWithState()显示Content停靠窗口,
//State.DockRight表明了是将窗口停靠在整个DockManager管理区域的右边
//可选的还有State.DockLeft,State.DockTop,State.DockBottom,State.Floating;
//返回值是WindowContent类型的变量,是用来容纳多个Content对象
WindowContent wc = dockManager.AddContentWithState(solutionExplorerContent, State.DockRight);
//下面将classViewContent加入停靠
dockManager.Contents.Add(classViewContent);
//将classViewContent加入到“资源管理器”窗口所在的WindowContent中
dockManager.AddContentToWindowContent(classViewContent, wc);
}
//菜单新建
private void 新建NToolStripMenuItem_Click(object sender, EventArgs e)
...{
Crownwood.Magic.Controls.TabPage page = new Crownwood.Magic.Controls.TabPage();
page.Title = "Example.cs";
page.Control = new CodeEditer();
centerPanel.TabPages.Add(page);
}
private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
...{
Application.Exit();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//加入using语句
using Crownwood.Magic.Common;
using Crownwood.Magic.Docking;
namespace WindowsApplication3
...{
public partial class MainForm : Form
...{
//主窗口MainForm类里定义DockingManager对象
private DockingManager dockManager;
/**//*DockingManager的数据成员OuterControl,InnerControl用来决定DockingManager所在的窗口上哪些区域不受到DockingManager停靠窗口的影响
* Docking Manager不会影响在OuterControl对象以后加入主窗口的对象的窗口区域
* Docking Manager也不会影响在InnerControl对象以前加入主窗口的对象的窗口区域
*/
//构造函数里添加初始化代码
public MainForm()
...{
InitializeComponent();
//生成IDE风格的管理窗口
dockManager = new DockingManager(this, VisualStyle.IDE);
dockManager.OuterControl = statusStrip1;
dockManager.InnerControl = centerPanel;
centerPanel.IDEPixelBorder = true;
//生成Content对象,该对象是DockingManager管理的浮动窗口
Content solutionExplorerContent = new Content(dockManager);
//用Content对象包装要管理的窗口
solutionExplorerContent.Control = new solutionExplorer();
//设置停靠窗口属性
//获取"解决方案资源管理器"窗口的初始窗口尺寸
Size solutionExplorerSize = solutionExplorerContent.Control.Size;
//设置当停靠窗口收缩成标签时标签上的标题
solutionExplorerContent.Title = "解决方案资源管理器";
//设置停靠窗口展开时的标题
solutionExplorerContent.FullTitle = "解决方案资源管理器-Example";
//设置Content停靠窗口从标签状态滑动出来成为窗口状态时窗口大小
solutionExplorerContent.AutoHideSize = solutionExplorerSize;
//设置停靠窗口被“钉”在DockManager管理窗口上时的尺寸
solutionExplorerContent.DisplaySize = solutionExplorerSize;
//设定停靠窗口收缩时标签上显示的小图标,viewImgs是用户事先定义好的ImageList类型变量
solutionExplorerContent.ImageList = viewImgs;
solutionExplorerContent.ImageIndex = 0;
Content classViewContent = new Content(dockManager);
classViewContent.Control = new ClassView();
Size classViewSize = classViewContent.Control.Size;
classViewContent.Title = "类视图";
classViewContent.FullTitle = "类视图-Exam";
classViewContent.AutoHideSize = classViewSize;
classViewContent.DisplaySize = classViewSize;
classViewContent.ImageList = viewImgs;
classViewContent.ImageIndex = 1;
//设置浮动窗口的属性,title是窗口收缩以后的标题
//FullTitle是窗口显示时的标题
//将浮动窗口和具体在浮动窗口中被包含的面板联系起来
dockManager.Contents.Add(solutionExplorerContent);
//用AddContentWithState()显示Content停靠窗口,
//State.DockRight表明了是将窗口停靠在整个DockManager管理区域的右边
//可选的还有State.DockLeft,State.DockTop,State.DockBottom,State.Floating;
//返回值是WindowContent类型的变量,是用来容纳多个Content对象
WindowContent wc = dockManager.AddContentWithState(solutionExplorerContent, State.DockRight);
//下面将classViewContent加入停靠
dockManager.Contents.Add(classViewContent);
//将classViewContent加入到“资源管理器”窗口所在的WindowContent中
dockManager.AddContentToWindowContent(classViewContent, wc);
}
//菜单新建
private void 新建NToolStripMenuItem_Click(object sender, EventArgs e)
...{
Crownwood.Magic.Controls.TabPage page = new Crownwood.Magic.Controls.TabPage();
page.Title = "Example.cs";
page.Control = new CodeEditer();
centerPanel.TabPages.Add(page);
}
private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
...{
Application.Exit();
}
}
}
相关文章推荐
- 利用MagicLibrary控件实现类似VsNet平台界面
- VS C# .NET WebBrowser控件 利用插入JS代码,实现控制弹出IE窗口
- 老瓶装新酒,结合jquery来实现asp.net repeater的主从表样式(类似masterdetail控件)
- ASP.Net中利用CSS实现多界面两法
- 如何利用asp.net控件实现这个功能?
- ASP.Net中利用CSS实现多界面的方法
- 利用ArcGIS Engine、VS .NET和Windows控件开发GIS应用
- 在ASP.Net中两种利用CSS实现多界面的方法
- 在ASP.Net中两种利用CSS实现多界面的方法
- 在ASP.Net中两种利用CSS实现多界面的方法
- ASP.NET巧妙利用repeater控件和checkBox控件实现批量操作
- 利用ArcGIS Engine、VS .NET和Windows控件开发GIS应用
- 在ASP.Net中两种利用CSS实现多界面的方法
- ASP.Net中利用CSS实现多界面两法
- 利用asp.net 2.0构建企业级门户平台(2、实现页面请求的调度)
- VS-利用AspNetPager控件实现真分页
- 利用JavaScript实现类似Delphi中数据敏感控件DBTextBox!
- 在ASP.Net中两种利用CSS实现多界面的方法
- 在ASP.Net中两种利用CSS实现多界面的方法
- 在ASP.Net中两种利用CSS实现多界面的方法.