public UserControl_PhysicsInstanceDefinition(PhysicsInstanceDefinition_WithCircle physicsInstanceDefinition_ex) : base("Physics Instance Type Definition", false) { PhysicsInstanceDefinitionType = physicsInstanceDefinition_ex.TypeOfInstance; m_physicsInstanceDefinition = physicsInstanceDefinition_ex.PhysicsInstanceDefinition; if (DataIsNull()) { m_textBlock_id.Text = "N/A"; m_textBox_name.Text = string.Empty; } else { m_textBlock_id.Text = m_physicsInstanceDefinition.Id.ToString(); m_textBox_name.Text = m_physicsInstanceDefinition.Name; m_comboBox_entityInstanceDefinition.SelectedItem = m_physicsInstanceDefinition.EntityInstanceDefinition; m_comboBox_collisionType.SelectedItem = m_physicsInstanceDefinition.CollisionType; m_comboBox_physType.SelectedItem = m_physicsInstanceDefinition.PhysType; var circle = physicsInstanceDefinition_ex as PhysicsInstanceDefinition_WithCircle; SetCircleControls(circle); } }
private void SetCircleControls(PhysicsInstanceDefinition_WithCircle circle) { Canvas.SetLeft(m_canvasWithRectangle.SizableRectangle, circle.OriginX - circle.Radius); Canvas.SetTop(m_canvasWithRectangle.SizableRectangle, circle.OriginY - circle.Radius); m_canvasWithRectangle.SizableRectangle.Width = circle.Radius * 2.0; m_canvasWithRectangle.SizableRectangle.Height = circle.Radius * 2.0; }