I am trying to get an array of all the controls on a toolstrip then test all of the controls to see if it is a toolstripbutton. if it is then I will add the width of the control to a variable. Here is My code...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
System::Array<System::Object>^ os;
this->toolStrip1->Controls->CopyTo(os, 0);
int totalWidth = 0;
for (int i = -; i < os->Length; i++)
{
if (os[i]->GetType() == System::Windows::Forms::ToolStripButton)
{
System::Windows::Forms::ToolStripButton t = os[i];
totalWidth += t.Size.Width;
}
}
this->toolStripTextBox1->Size = System::Drawing::Size(this->toolStrip1->Size.Width - (totalWidth + 15), this->toolStripTextBox1->Size.Height);
I can't figure out how to convert the array item into a System::Object so that it can be compared to the ToolStripButtonclass. any Ideas?