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

📄 documentform.h

📁 实现了很好的客户关系管理功能
💻 H
📖 第 1 页 / 共 2 页
字号:
			// 自编号TextBox
			// 
			this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->内部文档BindingSource, L"自编号", true)));
			this->自编号TextBox->Location = System::Drawing::Point(68, 27);
			this->自编号TextBox->Name = L"自编号TextBox";
			this->自编号TextBox->ReadOnly = true;
			this->自编号TextBox->Size = System::Drawing::Size(200, 21);
			this->自编号TextBox->TabIndex = 23;
			// 
			// 文档日期DateTimePicker
			// 
			this->文档日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->内部文档BindingSource, L"文档日期", 
				true)));
			this->文档日期DateTimePicker->Location = System::Drawing::Point(68, 54);
			this->文档日期DateTimePicker->Name = L"文档日期DateTimePicker";
			this->文档日期DateTimePicker->Size = System::Drawing::Size(200, 21);
			this->文档日期DateTimePicker->TabIndex = 25;
			// 
			// 文档标题TextBox
			// 
			this->文档标题TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->内部文档BindingSource, L"文档标题", true)));
			this->文档标题TextBox->Location = System::Drawing::Point(68, 81);
			this->文档标题TextBox->Name = L"文档标题TextBox";
			this->文档标题TextBox->Size = System::Drawing::Size(200, 21);
			this->文档标题TextBox->TabIndex = 27;
			// 
			// 内容摘要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(343, 27);
			this->内容摘要TextBox->Multiline = true;
			this->内容摘要TextBox->Name = L"内容摘要TextBox";
			this->内容摘要TextBox->Size = System::Drawing::Size(195, 130);
			this->内容摘要TextBox->TabIndex = 29;
			// 
			// 存放路径TextBox
			// 
			this->存放路径TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->内部文档BindingSource, L"存放路径", true)));
			this->存放路径TextBox->Location = System::Drawing::Point(5, 136);
			this->存放路径TextBox->Name = L"存放路径TextBox";
			this->存放路径TextBox->ReadOnly = true;
			this->存放路径TextBox->Size = System::Drawing::Size(263, 21);
			this->存放路径TextBox->TabIndex = 31;
			// 
			// 内部文档DataGridView
			// 
			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^  >(5) {this->dataGridViewTextBoxColumn1, 
				this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5});
			this->内部文档DataGridView->DataSource = this->内部文档BindingSource;
			this->内部文档DataGridView->Location = System::Drawing::Point(5, 163);
			this->内部文档DataGridView->MultiSelect = false;
			this->内部文档DataGridView->Name = L"内部文档DataGridView";
			this->内部文档DataGridView->ReadOnly = true;
			this->内部文档DataGridView->RowTemplate->Height = 23;
			this->内部文档DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
			this->内部文档DataGridView->Size = System::Drawing::Size(533, 248);
			this->内部文档DataGridView->TabIndex = 21;
			// 
			// bindingNavigatorMoveLastItem
			// 
			this->bindingNavigatorMoveLastItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMoveLastItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMoveLastItem.Image")));
			this->bindingNavigatorMoveLastItem->Name = L"bindingNavigatorMoveLastItem";
			this->bindingNavigatorMoveLastItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMoveLastItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMoveLastItem->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, &DocumentForm::bindingNavigatorAddNewItem_MouseUp);
			// 
			// 内部文档BindingNavigator
			// 
			this->内部文档BindingNavigator->AddNewItem = this->bindingNavigatorAddNewItem;
			this->内部文档BindingNavigator->BindingSource = this->内部文档BindingSource;
			this->内部文档BindingNavigator->CountItem = this->bindingNavigatorCountItem;
			this->内部文档BindingNavigator->DeleteItem = this->bindingNavigatorDeleteItem;
			this->内部文档BindingNavigator->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(12) {this->bindingNavigatorMoveFirstItem, 
				this->bindingNavigatorMovePreviousItem, this->bindingNavigatorSeparator, this->bindingNavigatorPositionItem, this->bindingNavigatorCountItem, 
				this->bindingNavigatorSeparator1, this->bindingNavigatorMoveNextItem, this->bindingNavigatorMoveLastItem, this->bindingNavigatorSeparator2, 
				this->bindingNavigatorAddNewItem, this->bindingNavigatorDeleteItem, this->内部文档BindingNavigatorSaveItem});
			this->内部文档BindingNavigator->Location = System::Drawing::Point(0, 0);
			this->内部文档BindingNavigator->MoveFirstItem = this->bindingNavigatorMoveFirstItem;
			this->内部文档BindingNavigator->MoveLastItem = this->bindingNavigatorMoveLastItem;
			this->内部文档BindingNavigator->MoveNextItem = this->bindingNavigatorMoveNextItem;
			this->内部文档BindingNavigator->MovePreviousItem = this->bindingNavigatorMovePreviousItem;
			this->内部文档BindingNavigator->Name = L"内部文档BindingNavigator";
			this->内部文档BindingNavigator->PositionItem = this->bindingNavigatorPositionItem;
			this->内部文档BindingNavigator->Size = System::Drawing::Size(542, 25);
			this->内部文档BindingNavigator->TabIndex = 20;
			this->内部文档BindingNavigator->Text = L"bindingNavigator1";
			// 
			// bindingNavigatorCountItem
			// 
			this->bindingNavigatorCountItem->Name = L"bindingNavigatorCountItem";
			this->bindingNavigatorCountItem->Size = System::Drawing::Size(35, 22);
			this->bindingNavigatorCountItem->Text = L"/ {0}";
			this->bindingNavigatorCountItem->ToolTipText = L"总项数";
			// 
			// 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"删除";
			// 
			// bindingNavigatorMoveFirstItem
			// 
			this->bindingNavigatorMoveFirstItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMoveFirstItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMoveFirstItem.Image")));
			this->bindingNavigatorMoveFirstItem->Name = L"bindingNavigatorMoveFirstItem";
			this->bindingNavigatorMoveFirstItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMoveFirstItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMoveFirstItem->Text = L"移到第一条记录";
			// 
			// bindingNavigatorMovePreviousItem
			// 
			this->bindingNavigatorMovePreviousItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMovePreviousItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMovePreviousItem.Image")));
			this->bindingNavigatorMovePreviousItem->Name = L"bindingNavigatorMovePreviousItem";
			this->bindingNavigatorMovePreviousItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMovePreviousItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMovePreviousItem->Text = L"移到上一条记录";
			// 
			// bindingNavigatorSeparator
			// 
			this->bindingNavigatorSeparator->Name = L"bindingNavigatorSeparator";
			this->bindingNavigatorSeparator->Size = System::Drawing::Size(6, 25);
			// 
			// bindingNavigatorPositionItem
			// 
			this->bindingNavigatorPositionItem->AccessibleName = L"位置";
			this->bindingNavigatorPositionItem->AutoSize = false;
			this->bindingNavigatorPositionItem->Name = L"bindingNavigatorPositionItem";
			this->bindingNavigatorPositionItem->Size = System::Drawing::Size(50, 21);
			this->bindingNavigatorPositionItem->Text = L"0";
			this->bindingNavigatorPositionItem->ToolTipText = L"当前位置";
			// 
			// bindingNavigatorSeparator1
			// 
			this->bindingNavigatorSeparator1->Name = L"bindingNavigatorSeparator1";
			this->bindingNavigatorSeparator1->Size = System::Drawing::Size(6, 25);
			// 
			// bindingNavigatorMoveNextItem
			// 
			this->bindingNavigatorMoveNextItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMoveNextItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMoveNextItem.Image")));
			this->bindingNavigatorMoveNextItem->Name = L"bindingNavigatorMoveNextItem";
			this->bindingNavigatorMoveNextItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMoveNextItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMoveNextItem->Text = L"移到下一条记录";
			// 
			// DocumentForm
			// 
			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->显示文件Button);
			this->Controls->Add(this->选择文件Button);
			this->Controls->Add(this->自编号TextBox);
			this->Controls->Add(this->文档日期DateTimePicker);
			this->Controls->Add(this->文档标题TextBox);
			this->Controls->Add(this->内容摘要TextBox);
			this->Controls->Add(this->存放路径TextBox);
			this->Controls->Add(this->内部文档DataGridView);
			this->Controls->Add(自编号Label);
			this->Controls->Add(文档日期Label);
			this->Controls->Add(文档标题Label);
			this->Controls->Add(内容摘要Label);
			this->Controls->Add(存放路径Label);
			this->Controls->Add(this->内部文档BindingNavigator);
			this->Name = L"DocumentForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"内部文档管理";
			this->Load += gcnew System::EventHandler(this, &DocumentForm::DocumentForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->MyCRMDataSet))->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^ MyCRMConnectionString= L"Data Source=.;Initial Catalog=MyCRM;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->MyCRMDataSet->内部文档);
		 }
		private: System::Void DocumentForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 // TODO: 这行代码将数据加载到表“MyCRMDataSet.内部文档”中。您可以根据需要移动或移除它。
			 this->内部文档TableAdapter->Fill(this->MyCRMDataSet->内部文档);
		 }
		private: System::Void bindingNavigatorAddNewItem_MouseUp(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
            //自动计算自编号
            String^ MySQLConnectionString = MyCRMConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            SqlCommand^ MyCommand = MyConnection->CreateCommand();
            MyCommand->CommandText = "Select max(自编号) 最大编号 From 内部文档";
			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 = "WD0000000" + MyID.ToString();
                    break;
                case 2:
                    MyNewID = "WD000000" + MyID.ToString();
                    break;
                case 3:
                    MyNewID = "WD00000" + MyID.ToString();
                    break;
                case 4:
                    MyNewID = "WD0000" + MyID.ToString();
                    break;
                case 5:
                    MyNewID = "WD000" + MyID.ToString();
                    break;
                case 6:
                    MyNewID = "WD00" + MyID.ToString();
                    break;
                case 7:
                    MyNewID = "WD0" + MyID.ToString();
                    break;
            }
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            this->自编号TextBox->Text = MyNewID;
		 }
		private: System::Void 选择文件Button_Click(System::Object^  sender, System::EventArgs^  e) {
            OpenFileDialog^ MyDlg = gcnew OpenFileDialog();
			if (MyDlg->ShowDialog() == System::Windows::Forms::DialogResult::OK)
            {
                this->存放路径TextBox->Text = MyDlg->FileName;
            }
		 }
		private: System::Void 显示文件Button_Click(System::Object^  sender, System::EventArgs^  e) {
					 System::Diagnostics::Process::Start(this->存放路径TextBox->Text);
		 }
	};
}

⌨️ 快捷键说明

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