📄 cinstore.h
字号:
#pragma once
#include "CDatamanage.h"
#include "CLogin.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>
/// CInStore 摘要
///
/// 警告: 如果更改此类的名称,则需要更改
/// 与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。否则,
/// 设计器将不能与此窗体的关联
/// 本地化资源正确交互。
/// </summary>
public ref class CInStore : public System::Windows::Forms::Form
{
public:
CInStore(void)
{
InitializeComponent();
CurInsertedRow = 0;
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~CInStore()
{
if (components)
{
delete components;
}
}
int CurInsertedRow;
//统计总数量
Decimal GroupNum()
{
Decimal temp = 0;
for (int i = 0; i<BookList->RowCount; i++)
{
String^ str= Convert::ToString(BookList->Rows[i]->Cells[3]->Value);
if (str != "")
{
temp += Convert::ToDecimal(str);
}
}
return temp;
}
//统计总金额
Decimal GroupMoney()
{
Decimal temp = 0;
for (int i = 0; i<BookList->RowCount; i++)
{
String^ str=Convert::ToString( BookList->Rows[i]->Cells[5]->Value);
if (str != "")
{
temp += Convert::ToDecimal(str);
}
}
return temp;
}
//清空编辑框文本
void ClearText()
{
BookName->Text = "";
Author->Text = "";
BookPrice->Text = "";
BookNum->Text = "0";
BookRebate->Text = "1.0";
}
//清空表格数据
void ClearGridData()
{
BookList->RowCount = 1;
for (int col = 0; col < BookList->ColumnCount;col++)
{
BookList->Rows[0]->Cells[col]->Value = "";
}
}
bool BookInfoIsNull()
{
for (int i = 0; i< groupBox1->Controls->Count;i++)
{
if (groupBox1->Controls[i]->GetType()->Name=="TextBox")
if (groupBox1->Controls[i]->Text=="")
{
return true;
}
}
return false;
}
CDataManage DataManage;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::DateTimePicker^ dateTime1;
private: System::Windows::Forms::TextBox^ Operator;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::TextBox^ TotalNum;
private: System::Windows::Forms::TextBox^ TotalMoney;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ ButtonCancel;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::DataGridView^ BookList;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column6;
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::GroupBox^ groupBox1;
private: System::Windows::Forms::TextBox^ BookPrice;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::TextBox^ BookName;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^ BookRebate;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::TextBox^ BookNum;
private: System::Windows::Forms::Label^ label8;
private: System::Windows::Forms::DataGridView^ AuList;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumn1;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumn2;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumn3;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumn4;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dataGridViewTextBoxColumn5;
private: System::Windows::Forms::TextBox^ Author;
private: System::Windows::Forms::Label^ label10;
protected:
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle1 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->dateTime1 = (gcnew System::Windows::Forms::DateTimePicker());
this->Operator = (gcnew System::Windows::Forms::TextBox());
this->BookList = (gcnew System::Windows::Forms::DataGridView());
this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->Column6 = (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->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->TotalNum = (gcnew System::Windows::Forms::TextBox());
this->TotalMoney = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->ButtonCancel = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->Author = (gcnew System::Windows::Forms::TextBox());
this->label10 = (gcnew System::Windows::Forms::Label());
this->BookRebate = (gcnew System::Windows::Forms::TextBox());
this->label9 = (gcnew System::Windows::Forms::Label());
this->BookNum = (gcnew System::Windows::Forms::TextBox());
this->label8 = (gcnew System::Windows::Forms::Label());
this->BookPrice = (gcnew System::Windows::Forms::TextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->BookName = (gcnew System::Windows::Forms::TextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->AuList = (gcnew System::Windows::Forms::DataGridView());
this->dataGridViewTextBoxColumn1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->dataGridViewTextBoxColumn2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->dataGridViewTextBoxColumn3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->dataGridViewTextBoxColumn4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->dataGridViewTextBoxColumn5 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->BookList))->BeginInit();
this->groupBox1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->AuList))->BeginInit();
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->BackColor = System::Drawing::Color::Transparent;
this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
this->label1->Font = (gcnew System::Drawing::Font(L"隶书", 21.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
this->label1->ForeColor = System::Drawing::Color::Red;
this->label1->Location = System::Drawing::Point(226, 12);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(199, 29);
this->label1->TabIndex = 0;
this->label1->Text = L"图书入库管理";
//
// label2
//
this->label2->AutoSize = true;
this->label2->ForeColor = System::Drawing::Color::Black;
this->label2->Location = System::Drawing::Point(19, 65);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(41, 12);
this->label2->TabIndex = 1;
this->label2->Text = L"操作员";
//
// label3
//
this->label3->AutoSize = true;
this->label3->ForeColor = System::Drawing::Color::Black;
this->label3->Location = System::Drawing::Point(493, 65);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(29, 12);
this->label3->TabIndex = 2;
this->label3->Text = L"时间";
//
// dateTime1
//
this->dateTime1->Location = System::Drawing::Point(538, 61);
this->dateTime1->Name = L"dateTime1";
this->dateTime1->Size = System::Drawing::Size(120, 21);
this->dateTime1->TabIndex = 3;
this->dateTime1->Enter += gcnew System::EventHandler(this, &CInStore::BookName_Enter);
//
// Operator
//
this->Operator->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
this->Operator->Enabled = false;
this->Operator->Location = System::Drawing::Point(78, 61);
this->Operator->Name = L"Operator";
this->Operator->Size = System::Drawing::Size(97, 21);
this->Operator->TabIndex = 4;
this->Operator->Enter += gcnew System::EventHandler(this, &CInStore::BookName_Enter);
//
// BookList
//
this->BookList->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(6) {this->Column1, this->Column6,
this->Column2, this->Column3, this->Column4, this->Column5});
dataGridViewCellStyle1->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle1->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle1->Font = (gcnew System::Drawing::Font(L"宋体", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(134)));
dataGridViewCellStyle1->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle1->SelectionBackColor = System::Drawing::Color::White;
dataGridViewCellStyle1->SelectionForeColor = System::Drawing::Color::Black;
dataGridViewCellStyle1->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
this->BookList->DefaultCellStyle = dataGridViewCellStyle1;
this->BookList->Location = System::Drawing::Point(21, 168);
this->BookList->Name = L"BookList";
this->BookList->RowHeadersVisible = false;
this->BookList->RowTemplate->Height = 23;
this->BookList->RowTemplate->ReadOnly = true;
this->BookList->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
this->BookList->Size = System::Drawing::Size(637, 232);
this->BookList->TabIndex = 0;
this->BookList->Enter += gcnew System::EventHandler(this, &CInStore::BookName_Enter);
this->BookList->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &CInStore::BookList_KeyDown);
this->BookList->RowsRemoved += gcnew System::Windows::Forms::DataGridViewRowsRemovedEventHandler(this, &CInStore::BookList_RowsRemoved);
//
// Column1
//
this->Column1->HeaderText = L"图书名称";
this->Column1->Name = L"Column1";
this->Column1->ReadOnly = true;
this->Column1->Width = 200;
//
// Column6
//
this->Column6->HeaderText = L"作者";
this->Column6->Name = L"Column6";
this->Column6->ReadOnly = true;
this->Column6->Width = 80;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -