?? form1.h
字號:
#pragma once
namespace Example
{
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 文件關(guān)聯(lián)的托管資源編譯器工具的
/// “資源文件名”屬性。 否則,
/// 設(shè)計(jì)器將不能與此窗體關(guān)聯(lián)的
/// 本地化資源正確交互。
/// </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::MainMenu * mainMenu1;
private: System::Windows::Forms::MenuItem * menuItem1;
private: System::Windows::Forms::MenuItem * menuItem2;
private: System::Windows::Forms::MenuItem * menuItem3;
private: System::Windows::Forms::MenuItem * menuItem4;
private: System::Windows::Forms::MenuItem * menuItem5;
private: System::Windows::Forms::MenuItem * menuItem6;
private: System::Windows::Forms::MenuItem * menuItem7;
private: System::Windows::Forms::MenuItem * menuItem8;
private: System::Windows::Forms::NotifyIcon * notifyIcon1;
private: System::Windows::Forms::ContextMenu * contextMenu1;
private: System::ComponentModel::IContainer * components;
private:
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(Example::Form1));
this->mainMenu1 = new System::Windows::Forms::MainMenu();
this->menuItem1 = new System::Windows::Forms::MenuItem();
this->menuItem2 = new System::Windows::Forms::MenuItem();
this->menuItem3 = new System::Windows::Forms::MenuItem();
this->menuItem4 = new System::Windows::Forms::MenuItem();
this->menuItem5 = new System::Windows::Forms::MenuItem();
this->menuItem6 = new System::Windows::Forms::MenuItem();
this->menuItem7 = new System::Windows::Forms::MenuItem();
this->menuItem8 = new System::Windows::Forms::MenuItem();
this->notifyIcon1 = new System::Windows::Forms::NotifyIcon(this->components);
this->contextMenu1 = new System::Windows::Forms::ContextMenu();
//
// mainMenu1
//
System::Windows::Forms::MenuItem* __mcTemp__1[] = new System::Windows::Forms::MenuItem*[1];
__mcTemp__1[0] = this->menuItem1;
this->mainMenu1->MenuItems->AddRange(__mcTemp__1);
//
// menuItem1
//
this->menuItem1->Index = 0;
System::Windows::Forms::MenuItem* __mcTemp__2[] = new System::Windows::Forms::MenuItem*[7];
__mcTemp__2[0] = this->menuItem2;
__mcTemp__2[1] = this->menuItem3;
__mcTemp__2[2] = this->menuItem4;
__mcTemp__2[3] = this->menuItem5;
__mcTemp__2[4] = this->menuItem6;
__mcTemp__2[5] = this->menuItem7;
__mcTemp__2[6] = this->menuItem8;
this->menuItem1->MenuItems->AddRange(__mcTemp__2);
this->menuItem1->Text = S"視圖(&V)";
//
// menuItem2
//
this->menuItem2->Index = 0;
this->menuItem2->Text = S"放置到托盤(&N)";
this->menuItem2->Click += new System::EventHandler(this, menuItem2_Click);
//
// menuItem3
//
this->menuItem3->Index = 1;
this->menuItem3->Text = S"-";
//
// menuItem4
//
this->menuItem4->Index = 2;
this->menuItem4->Text = S"恢復(fù)正常顯示(&R)";
this->menuItem4->Click += new System::EventHandler(this, menuItem4_Click);
//
// menuItem5
//
this->menuItem5->Index = 3;
this->menuItem5->Text = S"-";
//
// menuItem6
//
this->menuItem6->Index = 4;
this->menuItem6->Text = S"顯示托盤窗體(&T)";
this->menuItem6->Click += new System::EventHandler(this, menuItem6_Click);
//
// menuItem7
//
this->menuItem7->Index = 5;
this->menuItem7->Text = S"-";
//
// menuItem8
//
this->menuItem8->Index = 6;
this->menuItem8->Text = S"關(guān)閉應(yīng)用程序(&C)";
this->menuItem8->Click += new System::EventHandler(this, menuItem8_Click);
//
// notifyIcon1
//
this->notifyIcon1->ContextMenu = this->contextMenu1;
this->notifyIcon1->Icon = (__try_cast<System::Drawing::Icon * >(resources->GetObject(S"notifyIcon1.Icon")));
this->notifyIcon1->Text = S"這是一個演示托盤的實(shí)例程序";
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->BackgroundImage = (__try_cast<System::Drawing::Image * >(resources->GetObject(S"$this.BackgroundImage")));
this->ClientSize = System::Drawing::Size(328, 206);
this->Icon = (__try_cast<System::Drawing::Icon * >(resources->GetObject(S"$this.Icon")));
this->MaximizeBox = false;
this->Menu = this->mainMenu1;
this->Name = S"Form1";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = S"演示創(chuàng)建托盤程序";
this->Load += new System::EventHandler(this, Form1_Load);
}
private: System::Void menuItem2_Click(System::Object * sender, System::EventArgs * e)
{//放置到托盤
this->set_Visible(false);
this->notifyIcon1->set_Visible(true);
}
private: System::Void menuItem4_Click(System::Object * sender, System::EventArgs * e)
{//恢復(fù)正常顯示
this->set_Visible(true);
this->notifyIcon1->set_Visible(false);
}
private: System::Void menuItem6_Click(System::Object * sender, System::EventArgs * e)
{//顯示托盤窗體
this->set_Visible(true);
this->notifyIcon1->set_Visible(true);
}
private: System::Void menuItem8_Click(System::Object * sender, System::EventArgs * e)
{//關(guān)閉應(yīng)用程序
this->Close();
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{//創(chuàng)建托盤菜單
//復(fù)制“放置到托盤(N)”菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem2->CloneMenu());
//復(fù)制分隔線菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem3->CloneMenu());
//復(fù)制“恢復(fù)正常顯示(R)”菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem4->CloneMenu());
//復(fù)制分隔線菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem5->CloneMenu());
//復(fù)制“顯示托盤窗體(T)”菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem6->CloneMenu());
//復(fù)制分隔線菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem7->CloneMenu());
//復(fù)制“關(guān)閉應(yīng)用程序(C)”菜單項(xiàng)
this->contextMenu1->MenuItems->Add(this->menuItem8->CloneMenu());
//this.contextMenu1.MergeMenu(this.mainMenu1.);
}
};
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -