📄 remindform.h
字号:
// dataGridViewTextBoxColumn4
//
this->dataGridViewTextBoxColumn4->DataPropertyName = L"地点";
this->dataGridViewTextBoxColumn4->HeaderText = L"地点";
this->dataGridViewTextBoxColumn4->Name = L"dataGridViewTextBoxColumn4";
this->dataGridViewTextBoxColumn4->ReadOnly = true;
//
// dataGridViewTextBoxColumn2
//
this->dataGridViewTextBoxColumn2->DataPropertyName = L"日期";
this->dataGridViewTextBoxColumn2->HeaderText = L"日期";
this->dataGridViewTextBoxColumn2->Name = L"dataGridViewTextBoxColumn2";
this->dataGridViewTextBoxColumn2->ReadOnly = true;
//
// dataGridViewTextBoxColumn3
//
this->dataGridViewTextBoxColumn3->DataPropertyName = L"标题";
this->dataGridViewTextBoxColumn3->HeaderText = L"标题";
this->dataGridViewTextBoxColumn3->Name = L"dataGridViewTextBoxColumn3";
this->dataGridViewTextBoxColumn3->ReadOnly = true;
//
// 自编号TextBox
//
this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->提醒事务管理BindingSource, L"自编号", true)));
this->自编号TextBox->Location = System::Drawing::Point(55, 25);
this->自编号TextBox->Name = L"自编号TextBox";
this->自编号TextBox->ReadOnly = true;
this->自编号TextBox->Size = System::Drawing::Size(219, 21);
this->自编号TextBox->TabIndex = 17;
//
// 日期DateTimePicker
//
this->日期DateTimePicker->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->提醒事务管理BindingSource, L"日期",
true)));
this->日期DateTimePicker->Location = System::Drawing::Point(321, 25);
this->日期DateTimePicker->Name = L"日期DateTimePicker";
this->日期DateTimePicker->Size = System::Drawing::Size(217, 21);
this->日期DateTimePicker->TabIndex = 19;
//
// 标题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(55, 52);
this->标题TextBox->Name = L"标题TextBox";
this->标题TextBox->Size = System::Drawing::Size(483, 21);
this->标题TextBox->TabIndex = 21;
//
// 地点TextBox
//
this->地点TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->提醒事务管理BindingSource, L"地点", true)));
this->地点TextBox->Location = System::Drawing::Point(55, 79);
this->地点TextBox->Name = L"地点TextBox";
this->地点TextBox->Size = System::Drawing::Size(219, 21);
this->地点TextBox->TabIndex = 23;
//
// 人员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(321, 79);
this->人员TextBox->Name = L"人员TextBox";
this->人员TextBox->Size = System::Drawing::Size(217, 21);
this->人员TextBox->TabIndex = 25;
//
// 说明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(55, 106);
this->说明TextBox->Name = L"说明TextBox";
this->说明TextBox->Size = System::Drawing::Size(483, 21);
this->说明TextBox->TabIndex = 27;
//
// bindingNavigatorDeleteItem
//
this->bindingNavigatorDeleteItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"bindingNavigatorDeleteItem.Image")));
this->bindingNavigatorDeleteItem->Name = L"bindingNavigatorDeleteItem";
this->bindingNavigatorDeleteItem->RightToLeftAutoMirrorImage = true;
this->bindingNavigatorDeleteItem->Size = System::Drawing::Size(49, 22);
this->bindingNavigatorDeleteItem->Text = L"删除";
//
// bindingNavigatorAddNewItem
//
this->bindingNavigatorAddNewItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"bindingNavigatorAddNewItem.Image")));
this->bindingNavigatorAddNewItem->Name = L"bindingNavigatorAddNewItem";
this->bindingNavigatorAddNewItem->RightToLeftAutoMirrorImage = true;
this->bindingNavigatorAddNewItem->Size = System::Drawing::Size(49, 22);
this->bindingNavigatorAddNewItem->Text = L"新增";
this->bindingNavigatorAddNewItem->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &RemindForm::bindingNavigatorAddNewItem_MouseUp);
//
// 开始日期ToolStripTextBox
//
this->开始日期ToolStripTextBox->Name = L"开始日期ToolStripTextBox";
this->开始日期ToolStripTextBox->Size = System::Drawing::Size(100, 25);
this->开始日期ToolStripTextBox->Text = L"2000-1-1";
//
// toolStripLabel1
//
this->toolStripLabel1->Name = L"toolStripLabel1";
this->toolStripLabel1->Size = System::Drawing::Size(59, 22);
this->toolStripLabel1->Text = L"开始日期:";
//
// 提醒事务管理DataGridView
//
this->提醒事务管理DataGridView->AllowUserToAddRows = false;
this->提醒事务管理DataGridView->AllowUserToDeleteRows = false;
this->提醒事务管理DataGridView->AllowUserToResizeRows = false;
this->提醒事务管理DataGridView->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->提醒事务管理DataGridView->AutoGenerateColumns = false;
this->提醒事务管理DataGridView->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(6) {this->dataGridViewTextBoxColumn1,
this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5,
this->dataGridViewTextBoxColumn6});
this->提醒事务管理DataGridView->DataSource = this->提醒事务管理BindingSource;
this->提醒事务管理DataGridView->Location = System::Drawing::Point(5, 132);
this->提醒事务管理DataGridView->MultiSelect = false;
this->提醒事务管理DataGridView->Name = L"提醒事务管理DataGridView";
this->提醒事务管理DataGridView->ReadOnly = true;
this->提醒事务管理DataGridView->RowHeadersVisible = false;
this->提醒事务管理DataGridView->RowTemplate->Height = 23;
this->提醒事务管理DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
this->提醒事务管理DataGridView->Size = System::Drawing::Size(533, 280);
this->提醒事务管理DataGridView->TabIndex = 15;
//
// 提醒事务管理BindingNavigator
//
this->提醒事务管理BindingNavigator->AddNewItem = this->bindingNavigatorAddNewItem;
this->提醒事务管理BindingNavigator->BindingSource = this->提醒事务管理BindingSource;
this->提醒事务管理BindingNavigator->CountItem = nullptr;
this->提醒事务管理BindingNavigator->DeleteItem = this->bindingNavigatorDeleteItem;
this->提醒事务管理BindingNavigator->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(9) {this->toolStripLabel1,
this->开始日期ToolStripTextBox, this->toolStripLabel2, this->结束日期ToolStripTextBox, this->查询ToolStripButton, this->bindingNavigatorSeparator2,
this->bindingNavigatorAddNewItem, this->bindingNavigatorDeleteItem, this->提醒事务管理BindingNavigatorSaveItem});
this->提醒事务管理BindingNavigator->Location = System::Drawing::Point(0, 0);
this->提醒事务管理BindingNavigator->MoveFirstItem = nullptr;
this->提醒事务管理BindingNavigator->MoveLastItem = nullptr;
this->提醒事务管理BindingNavigator->MoveNextItem = nullptr;
this->提醒事务管理BindingNavigator->MovePreviousItem = nullptr;
this->提醒事务管理BindingNavigator->Name = L"提醒事务管理BindingNavigator";
this->提醒事务管理BindingNavigator->PositionItem = nullptr;
this->提醒事务管理BindingNavigator->Size = System::Drawing::Size(542, 25);
this->提醒事务管理BindingNavigator->TabIndex = 14;
this->提醒事务管理BindingNavigator->Text = L"bindingNavigator1";
//
// RemindForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(542, 416);
this->Controls->Add(自编号Label);
this->Controls->Add(this->自编号TextBox);
this->Controls->Add(日期Label);
this->Controls->Add(this->日期DateTimePicker);
this->Controls->Add(标题Label);
this->Controls->Add(this->标题TextBox);
this->Controls->Add(this->地点TextBox);
this->Controls->Add(this->人员TextBox);
this->Controls->Add(this->说明TextBox);
this->Controls->Add(地点Label);
this->Controls->Add(人员Label);
this->Controls->Add(说明Label);
this->Controls->Add(this->提醒事务管理DataGridView);
this->Controls->Add(this->提醒事务管理BindingNavigator);
this->Name = L"RemindForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"提醒事务管理";
this->Load += gcnew System::EventHandler(this, &RemindForm::RemindForm_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->MyOfficeDataSet))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->提醒事务管理BindingSource))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->提醒事务管理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^ MyOfficeConnectionString= L"Data Source=.;Initial Catalog=MyOffice;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->MyOfficeDataSet->提醒事务管理);
}
private: System::Void RemindForm_Load(System::Object^ sender, System::EventArgs^ e) {
// TODO: 这行代码将数据加载到表“MyOfficeDataSet.提醒事务管理”中。您可以根据需要移动或移除它。
this->提醒事务管理TableAdapter->Fill(this->MyOfficeDataSet->提醒事务管理);
}
private: System::Void 查询ToolStripButton_Click(System::Object^ sender, System::EventArgs^ e) {
try
{
this->提醒事务管理TableAdapter->FillBy(this->MyOfficeDataSet->提醒事务管理, System::Nullable<System::DateTime >((*cli::safe_cast<System::DateTime^>(System::Convert::ChangeType(开始日期ToolStripTextBox->Text,
System::DateTime::typeid)))), System::Nullable<System::DateTime >((*cli::safe_cast<System::DateTime^>(System::Convert::ChangeType(结束日期ToolStripTextBox->Text, System::DateTime::typeid)))));
}
catch (System::Exception^ ex) {
System::Windows::Forms::MessageBox::Show(ex->Message);
}
}
private: System::Void bindingNavigatorAddNewItem_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
//自动计算自编号
String^ MySQLConnectionString = MyOfficeConnectionString;
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
String^ MySQL = "Select max(自编号) 自编号 From 提醒事务管理";
SqlCommand^ MyCommand = gcnew SqlCommand(MySQL, MyConnection);
System::Object^ MyResult = MyCommand->ExecuteScalar();
System::Int64 MyID = 1;
if (MyResult != System::DBNull::Value)
{
String^ MyMaxID = MyResult->ToString()->Trim();
MyMaxID = MyMaxID->Substring(2, MyMaxID->Length - 2);
MyID = Convert::ToInt64(MyMaxID) + 1;
}
int MyLength = MyID.ToString()->Length;
String^ MyNewID = "";
switch (MyLength)
{
case 1:
MyNewID = "TX0000000" + MyID.ToString();
break;
case 2:
MyNewID = "TX000000" + MyID.ToString();
break;
case 3:
MyNewID = "TX00000" + MyID.ToString();
break;
case 4:
MyNewID = "TX0000" + MyID.ToString();
break;
case 5:
MyNewID = "TX000" + MyID.ToString();
break;
case 6:
MyNewID = "TX00" + MyID.ToString();
break;
case 7:
MyNewID = "TX0" + MyID.ToString();
break;
}
if(MyConnection->State==ConnectionState::Open)
{
MyConnection->Close();
}
this->自编号TextBox->Text = MyNewID;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -