📄 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 ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: AxPDG2Lib::AxT_Pdg01^ axT_Pdg011;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::ListBox^ listBox1;
protected:
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->axT_Pdg011 = (gcnew AxPDG2Lib::AxT_Pdg01());
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axT_Pdg011))->BeginInit();
this->SuspendLayout();
//
// axT_Pdg011
//
this->axT_Pdg011->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
| System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->axT_Pdg011->Enabled = true;
this->axT_Pdg011->Location = System::Drawing::Point(92, 1);
this->axT_Pdg011->Name = L"axT_Pdg011";
this->axT_Pdg011->OcxState = (cli::safe_cast<System::Windows::Forms::AxHost::State^ >(resources->GetObject(L"axT_Pdg011.OcxState")));
this->axT_Pdg011->Size = System::Drawing::Size(297, 208);
this->axT_Pdg011->TabIndex = 0;
//
// button1
//
this->button1->Location = System::Drawing::Point(0, 1);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(86, 23);
this->button1->TabIndex = 1;
this->button1->Text = L"浏览超星图书";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(1, 21);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(87, 21);
this->textBox1->TabIndex = 2;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(2, 45);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(89, 12);
this->label1->TabIndex = 3;
this->label1->Text = L"选择图书页码:";
//
// listBox1
//
this->listBox1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom)
| System::Windows::Forms::AnchorStyles::Left));
this->listBox1->FormattingEnabled = true;
this->listBox1->ItemHeight = 12;
this->listBox1->Location = System::Drawing::Point(0, 61);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(86, 148);
this->listBox1->TabIndex = 4;
this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(390, 210);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Controls->Add(this->axT_Pdg011);
this->Name = L"Form1";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = L"演示制作超星格式图书阅读器";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->axT_Pdg011))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
//显示超星图书内容
private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
try
{
String^ MyFileName=this->listBox1->Text;
this->axT_Pdg011->LoadPage(MyFileName,0,0,10);
this->axT_Pdg011->Refresh();
}
catch(Exception^ MyEx)
{
MessageBox::Show(MyEx->Message,"信息提示", MessageBoxButtons::OK,MessageBoxIcon::Information);
}
}
//浏览超星图书
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
FolderBrowserDialog^ MyDlg=gcnew FolderBrowserDialog();
if(MyDlg->ShowDialog()==System::Windows::Forms::DialogResult::OK)
{
this->listBox1->Items->Clear();
this->textBox1->Text=MyDlg->SelectedPath;
array<String^,1>^ MyFiles=System::IO::Directory::GetFiles(this->textBox1->Text);
for each(String^ MyFile in MyFiles)
{
this->listBox1->Items->Add(MyFile);
}
}
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -