/// <summary> /// The on mouse move event handler /// Draws correspond arrows /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> protected void onMouseMoveArrow(object sender, MouseEventArgs e) { if (!StaticExtensionDiagramUIForms.IsArrowClick(e)) { return; } if (Desktop.ActiveArrow == null) { return; } Desktop.DrawArrow(this, e); }
public UserControlLog() { InitializeComponent(); this.ForEeach((Control control) => { control.AllowDrop = true; control.DragDrop += UserControlLog_DragDrop; control.DragEnter += UserControlLog_DragEnter; control.DragLeave += UserControlLog_DragLeave; }); toolStripMenuItemLogDirectory.Click += (object sender, EventArgs e) => { StaticExtensionDiagramUIForms.OpenLogDirectory(); }; toolStripMenuItemConnectionString.Click += (object sender, EventArgs e) => { StaticExtensionEventUI.EditConnectionSrtring(); }; }
/// <summary> /// The on mouse down event handler /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> protected void onMouseDownMoveEventHandler(object sender, MouseEventArgs e) { if ((ModifierKeys & Keys.Shift) == Keys.Shift) { return; } if (!StaticExtensionDiagramUIForms.IsArrowClick(e)) { return; } if (EditorRectangle.Contains(e.X, e.Y)) { return; } PaletteButton active = Desktop.Tools.Active; if (active != null) { if (active.IsArrow & active.ReflectionType != null) { try { ICategoryArrow arrow = Desktop.Tools.Factory.CreateArrow(active); arrow.Source = Object; Desktop.ActiveArrow = arrow; Desktop.ActiveObjectLabel = this; return; } catch (Exception ex) { ex.ShowError(10); return; } } } isMoved = true; Desktop.IsMoved = true; Desktop.SetBlocking(true); mouseX = e.X; mouseY = e.Y; }
private void MouseUp(object sender, MouseEventArgs e) { Control caption = sender as Control; IsMoved = false; pDesktop.SetBlocking(false); PanelDesktop Desktop = pDesktop; ICategoryArrow arrow = Desktop.ActiveArrow; if (!StaticExtensionDiagramUIForms.IsArrowClick(e)) { return; } try { if (arrow == null) { pDesktop.Redraw(); return; } int x = this.label.X + caption.Left + e.X; int y = this.label.Y + caption.Top + e.Y; for (int i = 0; i < Desktop.Controls.Count; i++) { if (!(Desktop.Controls[i] is IChildObjectLabel) & !(Desktop.Controls[i] is IObjectLabelUI)) { continue; } Control c = Desktop.Controls[i]; bool hor = x <c.Left | x> c.Left + c.Width; bool vert = y <c.Top | y> c.Top + c.Height; if (hor | vert) { continue; } IObjectLabel label = null; if (Desktop.Controls[i] is IObjectLabelUI) { label = Desktop.Controls[i] as IObjectLabel; } else { IChildObjectLabel child = Desktop.Controls[i] as IChildObjectLabel; label = child.Label; } arrow.Target = label.Object; IArrowLabel lab = Desktop.Tools.Factory.CreateArrowLabel(Desktop.Tools.Active, arrow, this.label, label); lab.Arrow.SetAssociatedObject(lab); Desktop.AddArrowLabel(lab); break; } } catch (Exception ex) { ex.ShowError(10); if (arrow != null) { if (arrow is IRemovableObject) { IRemovableObject rem = arrow as IRemovableObject; rem.RemoveObject(); } } ex.ShowError(1); } Desktop.ActiveArrow = null; Desktop.Redraw(); }
void IStartStop.Action(object type, ActionType actionType) { StaticExtensionDiagramUIForms.Action(form, type, actionType); }
/// <summary> /// The on mouse up event handler /// </summary> /// <param name="sender">The sender</param> /// <param name="e">The event arguments</param> protected void onMouseUpArrow(object sender, MouseEventArgs e) { //isMoved = false; PanelDesktop desktop = Parent as PanelDesktop; ICategoryArrow arrow = desktop.ActiveArrow; if (!StaticExtensionDiagramUIForms.IsArrowClick(e)) { return; } if (!(nc is IObjectLabel)) { return; } IObjectLabel ol = nc as IObjectLabel; ICategoryObject obj = ol.Object; try { if (arrow == null) { return; } int x = Left + e.X; int y = Top + e.Y; for (int i = 0; i < desktop.Controls.Count; i++) { if (!(desktop.Controls[i] is ChildObjectLabel) & !(desktop.Controls[i] is ObjectLabel)) { continue; } Control c = desktop.Controls[i]; bool hor = x <c.Left | x> c.Left + c.Width; bool vert = y <c.Top | y> c.Top + c.Height; if (hor | vert) { continue; } IObjectLabel label = null; if (desktop.Controls[i] is IObjectLabel) { label = desktop.Controls[i] as IObjectLabel; } else { ChildObjectLabel child = desktop.Controls[i] as ChildObjectLabel; label = child.Label; } arrow.Target = label.Object; ArrowLabel lab = desktop.Tools.Factory.CreateArrowLabel(desktop.Tools.Active, arrow, ol, label) as ArrowLabel; lab.Arrow.Object = lab; desktop.AddArrowLabel(lab); break; } } catch (Exception ex) { ex.ShowError(10); if (arrow != null) { if (arrow is IRemovableObject) { IRemovableObject rem = arrow as IRemovableObject; rem.RemoveObject(); } } ex.ShowError(1); } desktop.ActiveArrow = null; desktop.Redraw(); }