void SelectionRectangleSelectionFinalized(object sender, SelectionEventArgs e) { if (Toolbox.SelectedButton == null) return; Type type = (Type)Toolbox.SelectedButton.Tag; BaseControl newControl = (BaseControl)Activator.CreateInstance(type); newControl.Position = e.Position; newControl.Size = e.Size; newControl.CanRaiseEvents = false; ControlSelector.TargetControl = newControl; Hud.BeginDesign(); Hud.Controls.Add(newControl); SelectionRectangle.IsVisible = false; ControlSelector.IsVisible = true; SelectionRectangle.BringToFront(); Hud.EndDesign(); //OdysseusForm.RenderPanel.Cursor = Cursors.Arrow; Toolbox.DeselectToolStripButton(); }
protected virtual void OnSelectionFinalized(object sender, SelectionEventArgs e) { EventHandler<SelectionEventArgs> handler = (EventHandler<SelectionEventArgs>)Events[EventSelectionFinalized]; if (handler != null) handler(this, e); }