📄 buildingform.h
字号:
住宅户数Label->AutoSize = true;
住宅户数Label->Location = System::Drawing::Point(432, 57);
住宅户数Label->Name = L"住宅户数Label";
住宅户数Label->Size = System::Drawing::Size(59, 12);
住宅户数Label->TabIndex = 39;
住宅户数Label->Text = L"住宅户数:";
//
// 管理楼长Label
//
管理楼长Label->AutoSize = true;
管理楼长Label->Location = System::Drawing::Point(8, 81);
管理楼长Label->Name = L"管理楼长Label";
管理楼长Label->Size = System::Drawing::Size(59, 12);
管理楼长Label->TabIndex = 41;
管理楼长Label->Text = L"管理楼长:";
//
// 联系电话Label
//
联系电话Label->AutoSize = true;
联系电话Label->Location = System::Drawing::Point(150, 81);
联系电话Label->Name = L"联系电话Label";
联系电话Label->Size = System::Drawing::Size(59, 12);
联系电话Label->TabIndex = 43;
联系电话Label->Text = L"联系电话:";
//
// 联系电话TextBox
//
this->联系电话TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"联系电话", true)));
this->联系电话TextBox->Location = System::Drawing::Point(215, 77);
this->联系电话TextBox->Name = L"联系电话TextBox";
this->联系电话TextBox->Size = System::Drawing::Size(85, 21);
this->联系电话TextBox->TabIndex = 44;
//
// 补充说明Label
//
补充说明Label->AutoSize = true;
补充说明Label->Location = System::Drawing::Point(306, 81);
补充说明Label->Name = L"补充说明Label";
补充说明Label->Size = System::Drawing::Size(59, 12);
补充说明Label->TabIndex = 45;
补充说明Label->Text = L"补充说明:";
//
// 补充说明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(371, 77);
this->补充说明TextBox->Name = L"补充说明TextBox";
this->补充说明TextBox->Size = System::Drawing::Size(161, 21);
this->补充说明TextBox->TabIndex = 46;
this->补充说明TextBox->Text = L"暂无";
//
// 管理楼长TextBox
//
this->管理楼长TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"管理楼长", true)));
this->管理楼长TextBox->Location = System::Drawing::Point(69, 77);
this->管理楼长TextBox->Name = L"管理楼长TextBox";
this->管理楼长TextBox->Size = System::Drawing::Size(75, 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(244, 28);
this->所处位置TextBox->Name = L"所处位置TextBox";
this->所处位置TextBox->Size = System::Drawing::Size(93, 21);
this->所处位置TextBox->TabIndex = 28;
//
// 单元信息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(402, 28);
this->单元信息TextBox->Name = L"单元信息TextBox";
this->单元信息TextBox->Size = System::Drawing::Size(129, 21);
this->单元信息TextBox->TabIndex = 30;
//
// 楼栋名称TextBox
//
this->楼栋名称TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"楼栋名称", true)));
this->楼栋名称TextBox->Location = System::Drawing::Point(70, 28);
this->楼栋名称TextBox->Name = L"楼栋名称TextBox";
this->楼栋名称TextBox->Size = System::Drawing::Size(108, 21);
this->楼栋名称TextBox->TabIndex = 26;
//
// 楼层信息TextBox
//
this->楼层信息TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"楼层信息", true)));
this->楼层信息TextBox->Location = System::Drawing::Point(70, 52);
this->楼层信息TextBox->Name = L"楼层信息TextBox";
this->楼层信息TextBox->Size = System::Drawing::Size(54, 21);
this->楼层信息TextBox->TabIndex = 32;
//
// 总人口数TextBox
//
this->总人口数TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"总人口数", true)));
this->总人口数TextBox->Location = System::Drawing::Point(185, 52);
this->总人口数TextBox->Name = L"总人口数TextBox";
this->总人口数TextBox->Size = System::Drawing::Size(42, 21);
this->总人口数TextBox->TabIndex = 34;
//
// 总户数TextBox
//
this->总户数TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"总户数", true)));
this->总户数TextBox->Location = System::Drawing::Point(274, 52);
this->总户数TextBox->Name = L"总户数TextBox";
this->总户数TextBox->Size = System::Drawing::Size(49, 21);
this->总户数TextBox->TabIndex = 36;
//
// 入住户数TextBox
//
this->入住户数TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->楼栋信息BindingSource, L"入住户数", true)));
this->入住户数TextBox->Location = System::Drawing::Point(390, 52);
this->入住户数TextBox->Name = L"入住户数TextBox";
this->入住户数TextBox->Size = System::Drawing::Size(40, 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(493, 52);
this->住宅户数TextBox->Name = L"住宅户数TextBox";
this->住宅户数TextBox->Size = System::Drawing::Size(39, 21);
this->住宅户数TextBox->TabIndex = 40;
//
// 打印ToolStripButton
//
this->打印ToolStripButton->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"打印ToolStripButton.Image")));
this->打印ToolStripButton->ImageTransparentColor = System::Drawing::Color::Magenta;
this->打印ToolStripButton->Name = L"打印ToolStripButton";
this->打印ToolStripButton->Size = System::Drawing::Size(51, 22);
this->打印ToolStripButton->Text = L"打印";
this->打印ToolStripButton->Click += gcnew System::EventHandler(this, &BuildingForm::打印ToolStripButton_Click);
//
// BuildingForm
//
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->楼栋信息DataGridView);
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->管理楼长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->楼栋信息BindingNavigator);
this->Name = L"BuildingForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"基本管理[楼栋信息管理]";
this->Load += gcnew System::EventHandler(this, &BuildingForm::BuildingForm_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->DBCommunityDataSet))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->楼栋信息BindingSource))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->楼栋信息BindingNavigator))->EndInit();
this->楼栋信息BindingNavigator->ResumeLayout(false);
this->楼栋信息BindingNavigator->PerformLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->楼栋信息DataGridView))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
public: String^ MyCommunity;
private: System::Void 楼栋信息BindingNavigatorSaveItem_Click(System::Object^ sender, System::EventArgs^ e)
{
this->Validate();
this->楼栋信息BindingSource->EndEdit();
this->楼栋信息TableAdapter->Update(this->DBCommunityDataSet->楼栋信息);
}
private: System::Void BuildingForm_Load(System::Object^ sender, System::EventArgs^ e)
{// TODO: 这行代码将数据加载到表“DBCommunityDataSet.楼栋信息”中
this->楼栋信息TableAdapter->Fill(this->DBCommunityDataSet->楼栋信息);
}
private: System::Void 打印ToolStripButton_Click(System::Object^ sender, System::EventArgs^ e)
{//打印楼栋信息
ApplicationClass^ MyExcel;
Workbooks^ MyWorkBooks;
Workbook^ MyWorkBook;
Worksheet^ MyWorkSheet;
char MyColumns;
int Count,i,j;
Range^ MyRange;
array<System::Object^,2>^ MyData=gcnew array<System::Object^,2>(5000,30);
MyExcel = gcnew ApplicationClass();
MyExcel->Visible = true;
if (MyExcel == nullptr)
{
MessageBox::Show("Excel程序无法启动!", "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
return;
}
MyWorkBooks = MyExcel->Workbooks;
MyWorkBook = MyWorkBooks->Add(Missing::Value);
MyWorkSheet = (Worksheet^)MyWorkBook->Worksheets[1];
MyColumns = (char)(this->DBCommunityDataSet->楼栋信息->Columns->Count + 64);
array<System::Byte>^ MyBytes =gcnew array<System::Byte> {MyColumns};
System::Text::UTF8Encoding^ MyEncoding=gcnew System::Text::UTF8Encoding();
MyRange = MyWorkSheet->Range["A5", MyEncoding->GetString(MyBytes) + "5"];
Count = 0;
for each (DataColumn^ MyNewColumn in this->DBCommunityDataSet->楼栋信息->Columns)
{
MyData[0, Count] = MyNewColumn->ColumnName;
Count = Count + 1;
}
j = 1;
//输出数据库记录
for each (DataRow^ MyRow in this->DBCommunityDataSet->楼栋信息->Rows)
{
for (i = 0; i < this->DBCommunityDataSet->楼栋信息->Columns->Count; i++)
{
MyData[j, i] = MyRow[i]->ToString();
}
j++;
}
MyRange = MyRange->Resize[this->DBCommunityDataSet->楼栋信息->Rows->Count + 1, this->DBCommunityDataSet->楼栋信息->Columns->Count];
MyRange->Value2 = MyData;
MyRange->EntireColumn->AutoFit();
MyWorkSheet->Cells[2, 2] = this->MyCommunity+ "楼栋信息表";
Range^ MyRange22 = MyWorkSheet->Range["B2", "B2"];
MyRange22->Font->Bold = true;
MyRange22->Font->Size = "20";
MyWorkSheet->Cells[4, 1] = "打印日期:" + DateTime::Now.ToShortDateString();
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -