form1.h

来自「Visual_C++.NET实用编程百例」· C头文件 代码 · 共 174 行

H
174
字号
#pragma once


namespace toolBar
{
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary> 
	/// Form1 摘要
	///
	/// 警告: 如果您更改该类的名称,则需要更改 
	///          与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的 
	///          “资源文件名”属性。  否则,
	///          设计器将不能与此窗体关联的
	///          本地化资源正确交互。
	/// </summary>
	public __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:
		Form1(void)
		{
			InitializeComponent();
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::ToolBar *  toolBar1;
	private: System::Windows::Forms::ImageList *  imageList1;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton1;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton2;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton3;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton4;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton5;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton6;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton7;
	private: System::Windows::Forms::ToolBarButton *  toolBarButton8;
	private: System::ComponentModel::IContainer *  components;

	private:
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>


		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();
			System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(toolBar::Form1));
			this->toolBar1 = new System::Windows::Forms::ToolBar();
			this->toolBarButton1 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton2 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton3 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton4 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton5 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton6 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton7 = new System::Windows::Forms::ToolBarButton();
			this->toolBarButton8 = new System::Windows::Forms::ToolBarButton();
			this->imageList1 = new System::Windows::Forms::ImageList(this->components);
			this->SuspendLayout();
			// 
			// toolBar1
			// 
			System::Windows::Forms::ToolBarButton* __mcTemp__1[] = new System::Windows::Forms::ToolBarButton*[8];
			__mcTemp__1[0] = this->toolBarButton1;
			__mcTemp__1[1] = this->toolBarButton2;
			__mcTemp__1[2] = this->toolBarButton3;
			__mcTemp__1[3] = this->toolBarButton4;
			__mcTemp__1[4] = this->toolBarButton5;
			__mcTemp__1[5] = this->toolBarButton6;
			__mcTemp__1[6] = this->toolBarButton7;
			__mcTemp__1[7] = this->toolBarButton8;
			this->toolBar1->Buttons->AddRange(__mcTemp__1);
			this->toolBar1->DropDownArrows = true;
			this->toolBar1->ImageList = this->imageList1;
			this->toolBar1->Location = System::Drawing::Point(0, 0);
			this->toolBar1->Name = S"toolBar1";
			this->toolBar1->ShowToolTips = true;
			this->toolBar1->Size = System::Drawing::Size(264, 28);
			this->toolBar1->TabIndex = 0;
			this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
			// 
			// toolBarButton1
			// 
			this->toolBarButton1->ImageIndex = 0;
			this->toolBarButton1->ToolTipText = S"新建";
			// 
			// toolBarButton2
			// 
			this->toolBarButton2->ImageIndex = 1;
			this->toolBarButton2->ToolTipText = S"打开";
			// 
			// toolBarButton3
			// 
			this->toolBarButton3->ImageIndex = 2;
			this->toolBarButton3->ToolTipText = S"保存";
			// 
			// toolBarButton4
			// 
			this->toolBarButton4->ImageIndex = 3;
			this->toolBarButton4->ToolTipText = S"剪切";
			// 
			// toolBarButton5
			// 
			this->toolBarButton5->ImageIndex = 4;
			this->toolBarButton5->ToolTipText = S"复制";
			// 
			// toolBarButton6
			// 
			this->toolBarButton6->ImageIndex = 5;
			this->toolBarButton6->ToolTipText = S"粘贴";
			// 
			// toolBarButton7
			// 
			this->toolBarButton7->ImageIndex = 6;
			this->toolBarButton7->ToolTipText = S"打印预览";
			// 
			// toolBarButton8
			// 
			this->toolBarButton8->ImageIndex = 7;
			this->toolBarButton8->ToolTipText = S"打印";
			// 
			// imageList1
			// 
			this->imageList1->ImageSize = System::Drawing::Size(16, 16);
			this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(264, 86);
			this->Controls->Add(this->toolBar1);
			this->Name = S"Form1";
			this->Text = S"useToolBar";
			this->ResumeLayout(false);

		}	
	private: System::Void toolBar1_ButtonClick(System::Object *  sender, System::Windows::Forms::ToolBarButtonClickEventArgs *  e)
			 {
				 switch(toolBar1->Buttons->IndexOf(e->Button))
				 {
				 case 0:
					 //在此添加新建按钮的事件处理函数
					 MessageBox::Show ("您单击的是新建按钮","信息");
					 break;
				 case 1:
					 ////在此添加打开按钮的事件处理函数
					 MessageBox::Show ("您单击的是打开按钮","信息");
					 break;
					 //其他省略
				 }
			 }

};
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?