📄 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 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </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::TrackBar * trackBar1;
private: System::Windows::Forms::Label * label1;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container * components;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->trackBar1 = new System::Windows::Forms::TrackBar();
this->label1 = new System::Windows::Forms::Label();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->trackBar1))->BeginInit();
this->SuspendLayout();
//
// trackBar1
//
this->trackBar1->Location = System::Drawing::Point(0, 32);
this->trackBar1->Maximum = 50;
this->trackBar1->Name = S"trackBar1";
this->trackBar1->Size = System::Drawing::Size(296, 45);
this->trackBar1->SmallChange = 2;
this->trackBar1->TabIndex = 1;
this->trackBar1->Value = 25;
this->trackBar1->ValueChanged += new System::EventHandler(this, trackBar1_ValueChanged);
//
// label1
//
this->label1->Location = System::Drawing::Point(8, 8);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(208, 16);
this->label1->TabIndex = 2;
this->label1->Text = S"拖动刻度条改变程序窗体透明度";
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(296, 198);
this->Controls->Add(this->label1);
this->Controls->Add(this->trackBar1);
this->MaximizeBox = false;
this->Name = S"Form1";
this->Opacity = 0.5;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = S"演示半透明显示程序窗体";
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->trackBar1))->EndInit();
this->ResumeLayout(false);
}
private: System::Void trackBar1_ValueChanged(System::Object * sender, System::EventArgs * e)
{//改变程序窗体透明度
this->Opacity=(float)(100-this->trackBar1->Value*2)/100;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -