📄 cbookinfomanage.h
字号:
#pragma once
#include "CDataManage.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Data::Common;
namespace BOOKMANAGE {
/// <summary>
/// CBookInfoManage 摘要
///
/// 警告: 如果更改此类的名称,则需要更改
/// 与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。否则,
/// 设计器将不能与此窗体的关联
/// 本地化资源正确交互。
/// </summary>
public ref class CBookInfoManage : public System::Windows::Forms::Form
{
public:
CBookInfoManage(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::ComboBox^ QueryCondition;
public:
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::DataGridView^ BookList;
private: System::Windows::Forms::Button^ ButtonQuery;
private: System::Windows::Forms::TextBox^ QueryValue;
private: System::Windows::Forms::Label^ label8;
CDataManage DataManage;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Colum1;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column2;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column3;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column4;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column5;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column6;
private: System::Windows::Forms::Button^ ButtionExit2;
private: System::Windows::Forms::Button^ ButtionCancel2;
private: System::Windows::Forms::Button^ ButtionSave2;
private: System::Windows::Forms::Panel^ panel2;
private: System::Windows::Forms::TextBox^ ISBN2;
private: System::Windows::Forms::TextBox^ BookConcern2;
private: System::Windows::Forms::TextBox^ BookPrice2;
private: System::Windows::Forms::TextBox^ Barcode2;
private: System::Windows::Forms::TextBox^ Author2;
private: System::Windows::Forms::TextBox^ BookName2;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::Label^ label10;
private: System::Windows::Forms::Label^ label11;
private: System::Windows::Forms::Label^ label12;
private: System::Windows::Forms::Label^ label13;
private: System::Windows::Forms::Label^ label14;
String^ QueryField; //查询字段
private: System::Windows::Forms::Button^ ButtonDelete;
int CurSelRow; //表格当前行
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~CBookInfoManage()
{
if (components)
{
delete components;
}
}
enum class CTag{tg_Add,tg_Update};
//判断图书信息是否为空
bool BookInfoIsNull(CTag tag)
{
if (tag==CTag::tg_Add)
{
for (int i = 0; i< Panel1->Controls->Count-1; i++)
{
if (Panel1->Controls[i]->GetType()->Name=="TextBox")
if (Panel1->Controls[i]->Text=="")
return true;
}
return false;
}
else if (tag==CTag::tg_Update)
{
for (int i = 0; i< panel2->Controls->Count-1; i++)
{
if (panel2->Controls[i]->GetType()->Name=="TextBox")
if (panel2->Controls[i]->Text=="")
return true;
}
return false;
}
return false; //由于CTag中目前只有两个取值,所以该语句不会执行
}
//清空编辑框中的文本
void ClearText(CTag tag)
{
if (tag==CTag::tg_Add)
{
for (int i = 0; i< Panel1->Controls->Count-1; i++)
{
if (Panel1->Controls[i]->GetType()->Name=="TextBox")
Panel1->Controls[i]->Text="";
}
}
else if (tag==CTag::tg_Update)
{
for (int i = 0; i< panel2->Controls->Count-1; i++)
{
if (panel2->Controls[i]->GetType()->Name=="TextBox")
panel2->Controls[i]->Text="";
}
}
}
//清空表格数据
void ClearList()
{
BookList->RowCount = 1;
for (int i = 0; i< BookList->ColumnCount; i++)
{
BookList->Rows[0]->Cells[i]->Value = "";
}
}
private: System::Windows::Forms::TabControl^ tabControl1;
private: System::Windows::Forms::TabPage^ BookAdd;
private: System::Windows::Forms::TabPage^ BookUpdate;
private: System::Windows::Forms::Panel^ Panel1;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Button^ ButtonSave;
private: System::Windows::Forms::TextBox^ ISBN;
private: System::Windows::Forms::TextBox^ BookConcern;
private: System::Windows::Forms::TextBox^ BookPrice;
private: System::Windows::Forms::TextBox^ Barcode;
private: System::Windows::Forms::TextBox^ Author;
private: System::Windows::Forms::TextBox^ BookName;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Button^ ButtonExit;
private: System::Windows::Forms::Button^ ButtonCancel;
protected:
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
this->BookAdd = (gcnew System::Windows::Forms::TabPage());
this->ButtonExit = (gcnew System::Windows::Forms::Button());
this->ButtonCancel = (gcnew System::Windows::Forms::Button());
this->ButtonSave = (gcnew System::Windows::Forms::Button());
this->Panel1 = (gcnew System::Windows::Forms::Panel());
this->ISBN = (gcnew System::Windows::Forms::TextBox());
this->BookConcern = (gcnew System::Windows::Forms::TextBox());
this->BookPrice = (gcnew System::Windows::Forms::TextBox());
this->Barcode = (gcnew System::Windows::Forms::TextBox());
this->Author = (gcnew System::Windows::Forms::TextBox());
this->BookName = (gcnew System::Windows::Forms::TextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label1 = (gcnew System::Windows::Forms::Label());
this->BookUpdate = (gcnew System::Windows::Forms::TabPage());
this->ButtonDelete = (gcnew System::Windows::Forms::Button());
this->ButtionExit2 = (gcnew System::Windows::Forms::Button());
this->ButtionCancel2 = (gcnew System::Windows::Forms::Button());
this->ButtionSave2 = (gcnew System::Windows::Forms::Button());
this->panel2 = (gcnew System::Windows::Forms::Panel());
this->ISBN2 = (gcnew System::Windows::Forms::TextBox());
this->BookConcern2 = (gcnew System::Windows::Forms::TextBox());
this->BookPrice2 = (gcnew System::Windows::Forms::TextBox());
this->Barcode2 = (gcnew System::Windows::Forms::TextBox());
this->Author2 = (gcnew System::Windows::Forms::TextBox());
this->BookName2 = (gcnew System::Windows::Forms::TextBox());
this->label9 = (gcnew System::Windows::Forms::Label());
this->label10 = (gcnew System::Windows::Forms::Label());
this->label11 = (gcnew System::Windows::Forms::Label());
this->label12 = (gcnew System::Windows::Forms::Label());
this->label13 = (gcnew System::Windows::Forms::Label());
this->label14 = (gcnew System::Windows::Forms::Label());
this->BookList = (gcnew System::Windows::Forms::DataGridView());
this->Colum1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column6 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->ButtonQuery = (gcnew System::Windows::Forms::Button());
this->QueryValue = (gcnew System::Windows::Forms::TextBox());
this->label8 = (gcnew System::Windows::Forms::Label());
this->QueryCondition = (gcnew System::Windows::Forms::ComboBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->tabControl1->SuspendLayout();
this->BookAdd->SuspendLayout();
this->Panel1->SuspendLayout();
this->BookUpdate->SuspendLayout();
this->panel2->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->BookList))->BeginInit();
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// tabControl1
//
this->tabControl1->Controls->Add(this->BookAdd);
this->tabControl1->Controls->Add(this->BookUpdate);
this->tabControl1->Location = System::Drawing::Point(18, 13);
this->tabControl1->Name = L"tabControl1";
this->tabControl1->SelectedIndex = 0;
this->tabControl1->Size = System::Drawing::Size(508, 300);
this->tabControl1->TabIndex = 0;
this->tabControl1->Selected += gcnew System::Windows::Forms::TabControlEventHandler(this, &CBookInfoManage::tabControl1_Selected);
this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &CBookInfoManage::tabControl1_SelectedIndexChanged);
//
// BookAdd
//
this->BookAdd->Controls->Add(this->ButtonExit);
this->BookAdd->Controls->Add(this->ButtonCancel);
this->BookAdd->Controls->Add(this->ButtonSave);
this->BookAdd->Controls->Add(this->Panel1);
this->BookAdd->Location = System::Drawing::Point(4, 21);
this->BookAdd->Name = L"BookAdd";
this->BookAdd->Padding = System::Windows::Forms::Padding(3);
this->BookAdd->Size = System::Drawing::Size(500, 275);
this->BookAdd->TabIndex = 0;
this->BookAdd->Text = L"图书信息添加";
this->BookAdd->UseVisualStyleBackColor = true;
//
// ButtonExit
//
this->ButtonExit->Location = System::Drawing::Point(364, 188);
this->ButtonExit->Name = L"ButtonExit";
this->ButtonExit->Size = System::Drawing::Size(75, 23);
this->ButtonExit->TabIndex = 3;
this->ButtonExit->Text = L"退出";
this->ButtonExit->UseVisualStyleBackColor = true;
this->ButtonExit->Click += gcnew System::EventHandler(this, &CBookInfoManage::ButtonExit_Click);
//
// ButtonCancel
//
this->ButtonCancel->Location = System::Drawing::Point(275, 188);
this->ButtonCancel->Name = L"ButtonCancel";
this->ButtonCancel->Size = System::Drawing::Size(75, 23);
this->ButtonCancel->TabIndex = 2;
this->ButtonCancel->Text = L"取消";
this->ButtonCancel->UseVisualStyleBackColor = true;
this->ButtonCancel->Click += gcnew System::EventHandler(this, &CBookInfoManage::ButtonCancel_Click);
//
// ButtonSave
//
this->ButtonSave->Location = System::Drawing::Point(187, 188);
this->ButtonSave->Name = L"ButtonSave";
this->ButtonSave->Size = System::Drawing::Size(75, 23);
this->ButtonSave->TabIndex = 1;
this->ButtonSave->Text = L"保存";
this->ButtonSave->UseVisualStyleBackColor = true;
this->ButtonSave->Click += gcnew System::EventHandler(this, &CBookInfoManage::button1_Click);
//
// Panel1
//
this->Panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
this->Panel1->Controls->Add(this->ISBN);
this->Panel1->Controls->Add(this->BookConcern);
this->Panel1->Controls->Add(this->BookPrice);
this->Panel1->Controls->Add(this->Barcode);
this->Panel1->Controls->Add(this->Author);
this->Panel1->Controls->Add(this->BookName);
this->Panel1->Controls->Add(this->label6);
this->Panel1->Controls->Add(this->label5);
this->Panel1->Controls->Add(this->label4);
this->Panel1->Controls->Add(this->label3);
this->Panel1->Controls->Add(this->label2);
this->Panel1->Controls->Add(this->label1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -