private void InitServo() { ConfigObject CONFIG = SYSTEM.configObject; gridRobot.Background = loadImage(CONFIG); for (byte i = 1; i <= CONFIG.max_servo; i++) { uc.UcServo us = new uc.UcServo(UBT.GetServo(i)); us.Width = 38; us.Height = 38; us.HorizontalAlignment = HorizontalAlignment.Left; us.VerticalAlignment = VerticalAlignment.Top; // us.Margin = new Thickness(servoPos[i, 0], servoPos[i, 1], 0, 0); us.Margin = new Thickness(CONFIG.servos[i - 1].X, CONFIG.servos[i - 1].Y, 0, 0); us.Show(); us.MouseDownEventHandler += Servo_MouseDown; servo[i] = us; gridRobot.Children.Add(us); } }