5
Answers

Changing Location of Toolstrips at startup

billypostman

billypostman

14y
10.1k
1
Hello everybody,

i have a wierd error in my code. The thing i want to do is, when i close and open the program, i want to see the toolstrips at their last locations. 
this method load coordinates of two toolstrip from an xml file into a datatable,  then i hold the values in coordinate as point type. And then, i want to assign the coordinate values to location of toolstrips, but it does not work correct :S

        public void LoadToolstripCoordinates()
        {
            int i;
            Point coordinates = new Point();
            DataTable dTable = new DataTable();
            dTable = ReadLogFromXml();
            if (dTable != null)
            {   
                for (i = 0; i < dTable.Rows.Count; i++)
                {
                    coordinates.X = Convert.ToInt32(dTable.Rows[i][1]);
                    coordinates.Y = Convert.ToInt32(dTable.Rows[i][2]);
                    if (loading == 0)
                    {
//here code does not work correct
                        if (i == 0) this.toolStrip1.Location = new System.Drawing.Point(coordinates.X,coordinates.Y);
                        if (i == 1) this.toolStrip2.Location = new System.Drawing.Point(coordinates.X,coordinates.Y);
                    }
                }
                loading=1;
            }
        }


this.toolStrip1.Location has x and y values,when i debug my code, i saw that  x value changes but y value does not change. i couldn't understand the problem, if u have any idea, please inform me


Attachment: Divit2.rar

Answers (5)