i am trying to get all the controls on a form, then write a text file that has that controls X, Y, Width, Height, And Text in that order.
this is what i have:
Code: Select all
foreach (Button btn in this.Controls)
{
string dir_ = Console.ReadLine() + "\\config";
System.IO.Directory.CreateDirectory(dir_);
System.IO.File.WriteAllText(dir_ + "\\" + btn.Name + ".btn", btn.Location.X.ToString() + Environment.NewLine + btn.Location.Y.ToString() + Environment.NewLine + btn.Size.Width.ToString() + Environment.NewLine + btn.Size.Height.ToString() + Environment.NewLine + btn.Text);
}