private void allControls_Click(object sender, EventArgs e) { Control tempControl = (Control)sender; IndexColorType tempIndexColorType = new IndexColorType(); tempIndexColorType.mIndex = tempControl.TabIndex; tempIndexColorType.mColor = tempControl.BackColor; tempIndexColorType.mType = tempControl.GetType().Name; int[] resultArr = myICommon.CallToServer(tempIndexColorType); if (resultArr == null) { return; } int currPosition = 3; for (int i = 0; i < resultArr.Length; i++) { arrControls[resultArr[i]].Location = new Point(currPosition, 50); currPosition += 42; } }