MenuBrowser
来源:互联网 发布:linux查找大文件命令 编辑:程序博客网 时间:2024/05/22 02:18
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using Microsoft.Office.Core;
using Extensibility;
using System.Runtime.InteropServices;
using EnvDTE;
namespace MenuBrowser
{
/// <summary>
/// MenuExplore 的摘要说明。
/// </summary>
public class MenuExplore : System.Windows.Forms.UserControl
{
public EnvDTE._DTE Application = null;
private System.Windows.Forms.ImageList ToolbarImageList;
private System.Windows.Forms.ToolBarButton toolBarButton1;
private System.Windows.Forms.RichTextBox tbMessage;
private System.Windows.Forms.ToolBar ToolBar;
private System.ComponentModel.IContainer components;
public MenuExplore()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent();
// TODO: 在 InitializeComponent 调用后添加任何初始化
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MenuExplore));
this.ToolBar = new System.Windows.Forms.ToolBar();
this.ToolbarImageList = new System.Windows.Forms.ImageList(this.components);
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
this.tbMessage = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// ToolBar
//
this.ToolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
this.ToolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton1});
this.ToolBar.ButtonSize = new System.Drawing.Size(20, 20);
this.ToolBar.DropDownArrows = true;
this.ToolBar.ImageList = this.ToolbarImageList;
this.ToolBar.Location = new System.Drawing.Point(0, 0);
this.ToolBar.Name = "ToolBar";
this.ToolBar.ShowToolTips = true;
this.ToolBar.Size = new System.Drawing.Size(248, 28);
this.ToolBar.TabIndex = 0;
this.ToolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.ToolBar_ButtonClick);
//
// ToolbarImageList
//
this.ToolbarImageList.ImageSize = new System.Drawing.Size(16, 16);
this.ToolbarImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ToolbarImageList.ImageStream")));
this.ToolbarImageList.TransparentColor = System.Drawing.Color.Transparent;
//
// toolBarButton1
//
this.toolBarButton1.ImageIndex = 0;
//
// tbMessage
//
this.tbMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbMessage.Location = new System.Drawing.Point(0, 28);
this.tbMessage.Name = "tbMessage";
this.tbMessage.Size = new System.Drawing.Size(248, 276);
this.tbMessage.TabIndex = 1;
this.tbMessage.Text = "";
//
// MenuExplore
//
this.Controls.Add(this.tbMessage);
this.Controls.Add(this.ToolBar);
this.Name = "MenuExplore";
this.Size = new System.Drawing.Size(248, 304);
this.ResumeLayout(false);
}
#endregion
private void ToolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
Commands commands = this.Application.Commands;
_CommandBars commandBars = Application.CommandBars;
CommandBar menuBar;
try
{
if(e.Button == this.ToolBar.Buttons[0])
{
int count = 0;
//获取开发环境的菜单条对象,是Office菜单条类型
this.tbMessage.Text = "CommandBars的子项 /n";
foreach(object bar in commandBars)
{
menuBar = (CommandBar)bar;
this.tbMessage.Text += "Name:"+menuBar.Name+"/t/t/t本地化名称:"+menuBar.NameLocal+"/n";
}
// Window frame = null;
#region 注释
// Window w1 = this.Application.Windows.Item(Constants.vsViewKindTextView);
// this.tbMessage.Text = "VS中的窗口: /n";
// foreach(Window window in this.Application.Windows)
// {
// this.tbMessage.Text += window.Caption+"--Linkable:"+window.Linkable+"--Kind:"+window.Kind+"/n";
//// if(window.Caption.Trim().Length == 0 && window.Linkable)
//// {
//// frame = window.LinkedWindowFrame;
//// frame.LinkedWindows.Add(w1);
//// }
// }
// Window w1 = this.applicationObject.Windows.Item(Constants.vsWindowKindObjectBrowser);
// Window w3 = this.applicationObject.Windows.Item(Constants.vsWindowKindCommandWindow);
// this.applicationObject.StatusBar.Text = w1.Kind;
//
//
// //Create a linked window frame and dock togther the Solution Explorer
// //and Ouput windows together inside it.
// frame = w1.LinkedWindowFrame;
// frame.LinkedWindows.Add(w2);
#endregion 注释
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
- MenuBrowser
- 今天偷个懒了,不用En文了,用中文写点咚咚吧。。。
- vb: 实时错误 '-214702470 (8007007e)':自动化错误
- prototype.js 的ajax.update调用时,执行包含的js
- javascript中的Function对象
- 转一下源代码
- MenuBrowser
- ArcGIS 9.2 笔记(3):三维功能
- How to run the Jar well?
- ArcGIS 9.2 笔记(4):数据互操作
- C++内存管理变革(3):另类内存管理
- 2007年CSDN网最实用文章是什么?
- 回忆的片断(截取)2006
- sql server 面试时 的考题!!(整理)
- 使用基本的ASP.NET服务器端控件的综合实例