⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libraryform.h

📁 vc++开发环境SQL数据库图书租借管理系统
💻 H
📖 第 1 页 / 共 4 页
字号:
			// 书名TextBox
			// 
			this->书名TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"书名", true)));
			this->书名TextBox->Location = System::Drawing::Point(187, 28);
			this->书名TextBox->Name = L"书名TextBox";
			this->书名TextBox->Size = System::Drawing::Size(209, 21);
			this->书名TextBox->TabIndex = 38;
			// 
			// 作者TextBox
			// 
			this->作者TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->作者TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"作者", true)));
			this->作者TextBox->Location = System::Drawing::Point(443, 28);
			this->作者TextBox->Name = L"作者TextBox";
			this->作者TextBox->Size = System::Drawing::Size(94, 21);
			this->作者TextBox->TabIndex = 40;
			// 
			// 出版社TextBox
			// 
			this->出版社TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"出版社", true)));
			this->出版社TextBox->Location = System::Drawing::Point(54, 54);
			this->出版社TextBox->Name = L"出版社TextBox";
			this->出版社TextBox->Size = System::Drawing::Size(142, 21);
			this->出版社TextBox->TabIndex = 42;
			// 
			// 书号TextBox
			// 
			this->书号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"书号", true)));
			this->书号TextBox->Location = System::Drawing::Point(43, 28);
			this->书号TextBox->Name = L"书号TextBox";
			this->书号TextBox->Size = System::Drawing::Size(96, 21);
			this->书号TextBox->TabIndex = 36;
			this->书号TextBox->Leave += gcnew System::EventHandler(this, &LibraryForm::书号TextBox_Leave);
			// 
			// 版次TextBox
			// 
			this->版次TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->版次TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"版次", true)));
			this->版次TextBox->Location = System::Drawing::Point(443, 54);
			this->版次TextBox->Name = L"版次TextBox";
			this->版次TextBox->Size = System::Drawing::Size(94, 21);
			this->版次TextBox->TabIndex = 44;
			// 
			// 规格TextBox
			// 
			this->规格TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"规格", true)));
			this->规格TextBox->Location = System::Drawing::Point(43, 79);
			this->规格TextBox->Name = L"规格TextBox";
			this->规格TextBox->Size = System::Drawing::Size(138, 21);
			this->规格TextBox->TabIndex = 46;
			// 
			// 印数TextBox
			// 
			this->印数TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"印数", true)));
			this->印数TextBox->Location = System::Drawing::Point(224, 79);
			this->印数TextBox->Name = L"印数TextBox";
			this->印数TextBox->Size = System::Drawing::Size(83, 21);
			this->印数TextBox->TabIndex = 48;
			// 
			// 页数TextBox
			// 
			this->页数TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"页数", true)));
			this->页数TextBox->Location = System::Drawing::Point(352, 79);
			this->页数TextBox->Name = L"页数TextBox";
			this->页数TextBox->Size = System::Drawing::Size(44, 21);
			this->页数TextBox->TabIndex = 50;
			// 
			// 单价TextBox
			// 
			this->单价TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->单价TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"单价", true)));
			this->单价TextBox->Location = System::Drawing::Point(443, 79);
			this->单价TextBox->Name = L"单价TextBox";
			this->单价TextBox->Size = System::Drawing::Size(94, 21);
			this->单价TextBox->TabIndex = 52;
			// 
			// 所属丛书TextBox
			// 
			this->所属丛书TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->馆藏图书BindingSource, L"所属丛书", true)));
			this->所属丛书TextBox->Location = System::Drawing::Point(67, 106);
			this->所属丛书TextBox->Name = L"所属丛书TextBox";
			this->所属丛书TextBox->Size = System::Drawing::Size(144, 21);
			this->所属丛书TextBox->TabIndex = 54;
			// 
			// 入库日期DateTimePicker
			// 
			this->入库日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->馆藏图书BindingSource, L"入库日期", 
				true)));
			this->入库日期DateTimePicker->Location = System::Drawing::Point(282, 106);
			this->入库日期DateTimePicker->Name = L"入库日期DateTimePicker";
			this->入库日期DateTimePicker->Size = System::Drawing::Size(147, 21);
			this->入库日期DateTimePicker->TabIndex = 56;
			// 
			// LibraryForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(542, 416);
			this->Controls->Add(this->类别ComboBox);
			this->Controls->Add(类别Label);
			this->Controls->Add(书号Label);
			this->Controls->Add(书名Label);
			this->Controls->Add(作者Label);
			this->Controls->Add(出版社Label);
			this->Controls->Add(版次Label);
			this->Controls->Add(规格Label);
			this->Controls->Add(印数Label);
			this->Controls->Add(页数Label);
			this->Controls->Add(单价Label);
			this->Controls->Add(所属丛书Label);
			this->Controls->Add(入库日期Label);
			this->Controls->Add(入库数量Label);
			this->Controls->Add(存放位置Label);
			this->Controls->Add(this->存放位置TextBox);
			this->Controls->Add(说明Label);
			this->Controls->Add(this->说明TextBox);
			this->Controls->Add(this->馆A藏图书DataGridView);
			this->Controls->Add(this->馆藏图书BindingNavigator);
			this->Controls->Add(this->入库数量TextBox);
			this->Controls->Add(this->书名TextBox);
			this->Controls->Add(this->作者TextBox);
			this->Controls->Add(this->出版社TextBox);
			this->Controls->Add(this->书号TextBox);
			this->Controls->Add(this->版次TextBox);
			this->Controls->Add(this->规格TextBox);
			this->Controls->Add(this->印数TextBox);
			this->Controls->Add(this->页数TextBox);
			this->Controls->Add(this->单价TextBox);
			this->Controls->Add(this->所属丛书TextBox);
			this->Controls->Add(this->入库日期DateTimePicker);
			this->Name = L"LibraryForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"馆藏图书登记";
			this->Load += gcnew System::EventHandler(this, &LibraryForm::LibraryForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->MyBooksDataSet))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->馆藏图书BindingSource))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->馆A藏图书DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->馆藏图书BindingNavigator))->EndInit();
			this->馆藏图书BindingNavigator->ResumeLayout(false);
			this->馆藏图书BindingNavigator->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		private: static String^ MyBooksConnectionString= L"Data Source=.;Initial Catalog=MyBooks;Integrated Security=True;Pooling=False";	
		private: System::Void 馆藏图书BindingNavigatorSaveItem_Click(System::Object^  sender, System::EventArgs^  e) {
			 this->Validate();
			 this->馆藏图书BindingSource->EndEdit();
			 this->馆藏图书TableAdapter->Update(this->MyBooksDataSet->馆藏图书);
		 }
		private: System::Void LibraryForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 // TODO: 这行代码将数据加载到表“MyBooksDataSet.馆藏图书”中。您可以根据需要移动或移除它。
			 this->馆藏图书TableAdapter->Fill(this->MyBooksDataSet->馆藏图书);
			 GetBooksUpdateKind();
		 }
		private: System::Void 出版社ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			PublisherForm^ MyDlg = gcnew PublisherForm();
            MyDlg->ShowDialog(); 
		 }
		private: System::Void 图书类别ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			KindForm^ MyDlg = gcnew KindForm();
            MyDlg->ShowDialog(); 
            GetBooksUpdateKind();
		 }
		private: void GetBooksUpdateKind()
        {
            this->类别ComboBox->Items->Clear();
            String^ MySQLConnectionString = MyBooksConnectionString;
            String^ MySQL = "Select  类别名称  From 图书类别";
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
			System::Data::DataTable^ MyTypeTable = gcnew System::Data::DataTable();
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyTypeTable);
            for each (DataRow^ MyRow in MyTypeTable->Rows)
            {
                this->类别ComboBox->Items->Add(MyRow["类别名称"]->ToString());
            }
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
         }		
		private: System::Void 书号TextBox_Leave(System::Object^  sender, System::EventArgs^  e) {
			String^ MyNumber = this->书号TextBox->Text->Remove(0, 2);
            int MyPos=MyNumber->IndexOf("-");
            int MyLength=MyNumber->Length-MyPos;
            String^ MyInfo = "7-" + MyNumber->Remove(MyPos, MyLength);
            String^ MySQLConnectionString = MyBooksConnectionString;
            String^ MySQL = "Select 名称  From 出版社信息 WHERE 编号='"+MyInfo+"'";
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
			System::Data::DataTable^ MyPublisherTable = gcnew System::Data::DataTable();
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyPublisherTable);
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            if (MyPublisherTable->Rows->Count == 0)
            {
                PublisherForm^ MyDlg = gcnew PublisherForm();
                MyDlg->ShowDialog();
            }
            else
            {
                String^ MyPublisher = MyPublisherTable->Rows[0][0]->ToString();
                this->出版社TextBox->Text = MyPublisher;
            }
		 }
	};
}

⌨️ 快捷键说明

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