Check if form is open

  • Thread starter Thread starter ollp
  • Start date Start date
O

ollp

Guest
Hi all

How come I can't check if form is open in the same manner, form menu and from trackbar.

System::Void Draw::MainForm::MenuItem1_Click(System::Object ^ sender, System::EventArgs ^ e)
{
if (this->frm == nullptr) { // if open do nothing works perfect open ones
this->frm = gcnew Animate();
// Set the MaximizeBox to false to remove the maximize box.
this->frm->MaximizeBox = false;
// Set the MinimizeBox to false to remove the minimize box.
this->frm->MinimizeBox = false;
this->frm->StartPosition = FormStartPosition::Manual;
this->frm->Left = (this->Location.X + this->Width);
this->frm->Top = this->Location.Y;
this->frm->Width = frm->Width;
this->frm->Height = frm->Height;
//open beside the main form
this->frm->Show();
}
}



System::Void Draw::MainForm::Trackbar_scroll(System::Object ^ sender, System::EventArgs ^ e)
{
if (this->frm == nullptr) {
// this works also if I have not open form
// But if form have been open and then closed
// it does not reset the values as supposed
rotate_index = trackbarConcurrent->Minimum;
trackbarConcurrent->Value = trackbarConcurrent->Minimum;
}
else{
if ((trackbarConcurrent->Value > 0) || (trackbarConcurrent->Value < 720)) {
rotate_index = trackbarConcurrent->Value;
if (trackbarConcurrent->Value > rotate_index) {
this->frm->RotateRight(trackbarConcurrent->Value);
trackbarConcurrent->Value = rotate_index;
}
else {
this->frm->RotateLeft(trackbarConcurrent->Value);
trackbarConcurrent->Value = rotate_index;
}
}

}
}

hope it's an easy answer to this

ollp

Continue reading...
 
Back
Top