private void templateController_TemplateShapeChanged(object sender, TemplateControllerTemplateShapeReplacedEventArgs e)
 {
     EnableButtons();
 }
示例#2
0
		private void templateController_TemplateShapeChanged(object sender, TemplateControllerTemplateShapeReplacedEventArgs e) {
			Debug.Assert(templateController != null && templateController.IsInitialized);
			if (templateController.WorkTemplate.Shape != null) {
				// assign displayservice so that the shape can be painted onto the previewPanel
				templateController.WorkTemplate.Shape.DisplayService = this;
				CenterShape(templateController.WorkTemplate.Shape);
				// Select appropiate Type in the shape list
				int cnt = templateController.Shapes.Count;
				ShapeType shapeType = templateController.WorkTemplate.Shape.Type;
				foreach (Shape shape in templateController.Shapes) {
					if (shape.Type == shapeType) {
						for (int i = 0; i < shapeComboBox.Items.Count; ++i) {
							ShapeItem item = (ShapeItem)shapeComboBox.Items[i];
							if (item.Shape == shape) {
								shapeComboBox.SelectedIndex = item.Index;
								break;
							}
						}
						break;
					}
				}
			}
			previewPanel.Invalidate();
		}