📄 parentform.h
字号:
this->groupBox1->Name = S"groupBox1";
this->groupBox1->Size = System::Drawing::Size(760, 79);
this->groupBox1->TabIndex = 1;
this->groupBox1->TabStop = false;
//
// tBoxQuery2
//
this->tBoxQuery2->Location = System::Drawing::Point(408, 39);
this->tBoxQuery2->Name = S"tBoxQuery2";
this->tBoxQuery2->Size = System::Drawing::Size(120, 21);
this->tBoxQuery2->TabIndex = 4;
this->tBoxQuery2->Text = S"";
//
// label2
//
this->label2->Location = System::Drawing::Point(337, 46);
this->label2->Name = S"label2";
this->label2->Size = System::Drawing::Size(63, 11);
this->label2->TabIndex = 3;
this->label2->Text = S"查询条件2";
//
// tBoxQuery1
//
this->tBoxQuery1->Location = System::Drawing::Point(208, 40);
this->tBoxQuery1->Name = S"tBoxQuery1";
this->tBoxQuery1->Size = System::Drawing::Size(120, 21);
this->tBoxQuery1->TabIndex = 2;
this->tBoxQuery1->Text = S"";
//
// label1
//
this->label1->Location = System::Drawing::Point(136, 45);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(64, 11);
this->label1->TabIndex = 1;
this->label1->Text = S"查询条件1";
//
// btnSearch
//
this->btnSearch->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
this->btnSearch->ImageIndex = 6;
this->btnSearch->ImageList = this->imageList1;
this->btnSearch->Location = System::Drawing::Point(64, 40);
this->btnSearch->Name = S"btnSearch";
this->btnSearch->Size = System::Drawing::Size(56, 24);
this->btnSearch->TabIndex = 0;
this->btnSearch->Text = S"搜索";
this->btnSearch->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
this->btnSearch->Click += new System::EventHandler(this, btnSearch_Click);
//
// tBoxQuery3
//
this->tBoxQuery3->Location = System::Drawing::Point(625, 40);
this->tBoxQuery3->Name = S"tBoxQuery3";
this->tBoxQuery3->Size = System::Drawing::Size(120, 21);
this->tBoxQuery3->TabIndex = 6;
this->tBoxQuery3->Text = S"";
//
// label4
//
this->label4->Location = System::Drawing::Point(559, 43);
this->label4->Name = S"label4";
this->label4->Size = System::Drawing::Size(65, 11);
this->label4->TabIndex = 5;
this->label4->Text = S"查询条件3";
//
// dgrdParent
//
this->dgrdParent->DataMember = S"";
this->dgrdParent->Dock = System::Windows::Forms::DockStyle::Fill;
this->dgrdParent->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdParent->Location = System::Drawing::Point(0, 120);
this->dgrdParent->Name = S"dgrdParent";
this->dgrdParent->Size = System::Drawing::Size(760, 261);
this->dgrdParent->TabIndex = 2;
//
// groupBox2
//
this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
this->groupBox2->Location = System::Drawing::Point(0, 381);
this->groupBox2->Name = S"groupBox2";
this->groupBox2->Size = System::Drawing::Size(760, 176);
this->groupBox2->TabIndex = 3;
this->groupBox2->TabStop = false;
//
// imageList1
//
this->imageList1->ImageSize = System::Drawing::Size(16, 16);
this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer * >(resources->GetObject(S"imageList1.ImageStream")));
this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
//
// ParentForm
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(760, 557);
this->Controls->Add(this->dgrdParent);
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->toolBar1);
this->Name = S"ParentForm";
this->Text = S"读者档案管理";
this->groupBox1->ResumeLayout(false);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdParent))->EndInit();
this->ResumeLayout(false);
}
private:
//----------------设置控件ReadOnly属性------------------------
void SetModify(bool isModifiable)
{
this->btnSearch->Enabled = !isModifiable;
this->dgrdParent->ReadOnly = !isModifiable;
}
//---------------------设置控件的数据邦定--------------------------
void SetDataBindings()
{
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStateControl()
{
}
//-----------------------工具栏按钮-----------------------
private:System::Void toolBar1_ButtonClick(System::Object * sender, System::Windows::Forms::ToolBarButtonClickEventArgs * e)
{
//设置控件属性
this->SetModify(false);
if(String::Compare(e->Button->ToolTipText,S"首记录") == 0)
{
this->dgrdParent->UnSelect(this->cmParent->Position);
this->cmParent->Position = 0;
this->dgrdParent->Select(this->cmParent->Position);
this->dgrdParent->CurrentRowIndex = this->cmParent->Position;
}
else if(String::Compare(e->Button->ToolTipText,S"上一记录") == 0)
{
if(this->cmParent->Position > 0)
{
this->dgrdParent->UnSelect(this->cmParent->Position);
this->cmParent->Position--;
this->dgrdParent->Select(this->cmParent->Position);
this->dgrdParent->CurrentRowIndex = this->cmParent->Position;
}
}
else if(String::Compare(e->Button->ToolTipText,S"下一记录") == 0)
{
if(this->cmParent->Position < this->cmParent->Count)
{
this->dgrdParent->UnSelect(this->cmParent->Position);
this->cmParent->Position++;
this->dgrdParent->Select(this->cmParent->Position);
this->dgrdParent->CurrentRowIndex = this->cmParent->Position;
}
}
else if(String::Compare(e->Button->ToolTipText,S"尾记录") == 0)
{
this->dgrdParent->UnSelect(this->cmParent->Position);
this->cmParent->Position = this->cmParent->Count;
this->dgrdParent->Select(this->cmParent->Position);
this->dgrdParent->CurrentRowIndex = this->cmParent->Position;
}
else if(String::Compare(e->Button->ToolTipText,S"新增") == 0)
{
this->cmParent->AddNew();
this->SetModify(true);
this->dgrdParent->UnSelect(this->cmParent->Position);
this->cmParent->Position = this->cmParent->Count;
this->dgrdParent->Select(this->cmParent->Position);
this->dgrdParent->CurrentRowIndex = this->cmParent->Position;
}
else if(String::Compare(e->Button->ToolTipText,S"修改") == 0)
{
this->SetModify(true);
}
else if(String::Compare(e->Button->ToolTipText,S"删除") == 0)
{
System::Windows::Forms::DialogResult r = MessageBox::Show(S"确定删除?",S"删除数据",MessageBoxButtons::OKCancel);
if(r == DialogResult::OK)
{
if(this->cmParent->Count > 0)
this->cmParent->RemoveAt(this->cmParent->Position);
else
MessageBox::Show(S"表格已空,无可删除数据",S"提示");
}
}
else if(String::Compare(e->Button->ToolTipText,S"提交") == 0)
{
this->cmParent->EndCurrentEdit();
this->MyDataBase->UpdateDataBase(this->ParentAdapter,this->ds,S"读者信息");
}
else if(String::Compare(e->Button->ToolTipText,S"取消") == 0)
{
try
{
this->cmParent->CancelCurrentEdit();
}
catch(Exception* e)
{
MessageBox::Show(e->Message,S"提示");
}
}
else if(String::Compare(e->Button->ToolTipText,S"退出") == 0)
{
this->Close();
}
}
//按条件查询
private: System::Void btnSearch_Click(System::Object * sender, System::EventArgs * e)
{
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -