//----------------------------------------------------------------- public override void OnMouseMoveNonStandard(object sender, MouseEventArgs e) { if ((ModeSourisCustom == EModeSourisCustom.LienWorkflow) && m_objetStartJoin != null && e.Button == MouseButtons.Left) { Graphics g = CreateGraphics(); Point ptCentre = new Point(m_rectStartLien.Left + m_rectStartLien.Width / 2, m_rectStartLien.Top + m_rectStartLien.Height / 2); Rectangle rct = m_rectLien; Point ptLogique = GetLogicalPointFromDisplay(new Point(e.X, e.Y)); IWorflowDessin dest = ObjetEdite.SelectionnerElementDuDessus(ptLogique) as IWorflowDessin; if (dest == m_objetStartJoin) { dest = null; } Rectangle rctDest = new Rectangle(e.X, e.Y, 1, 1); if (dest != null) { rctDest = dest.RectangleAbsolu; rctDest = new Rectangle(GetDisplayPointFromLogical(rctDest.Location), GetDisplaySizeFromLogical(rctDest.Size)); } rct.Inflate(2, 2); using (Bitmap bmp = DernierApercuToDispose) g.DrawImage(bmp, rct, rct, GraphicsUnit.Pixel); if (Control.ModifierKeys == Keys.Control) { Brush br = new SolidBrush(Color.FromArgb(128, 255, 0, 0)); g.FillRectangle(br, m_rectStartLien); m_rectLien = m_rectStartLien; } else { Pen pen = new Pen(Color.Blue); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; Brush br = new SolidBrush(Color.FromArgb(128, 0, 0, 255)); g.FillRectangle(br, m_rectStartLien); if (dest != null) { g.FillRectangle(br, rctDest); } br.Dispose(); g.DrawLine(pen, ptCentre, new Point(e.X, e.Y)); pen.Dispose(); g.Dispose(); m_rectLien = Rectangle.Union(m_rectStartLien, rctDest); } } }
//---------------------------------------------------------- public override void DeleteChild(I2iObjetGraphique child) { C2iObjetGraphique objet = child as C2iObjetGraphique; if (objet != null && m_listeFils.Contains(objet)) { IWorflowDessin wkf = child as IWorflowDessin; if (wkf != null) { CResultAErreur result = wkf.Delete(); if (!result) { return; } } } base.DeleteChild(child); }
//--------------------------------- private void m_panelFormulaire_SelectionChanged(object sender, EventArgs e) { if (m_panelWorkflow.Selection.Count == 1) { bool bDrawInfo = false; m_gridProprietes.SelectedObject = m_panelWorkflow.Selection[0]; CWorkflowEtapeDessin objetDessin = m_panelWorkflow.Selection[0] as CWorkflowEtapeDessin; if (objetDessin != null && objetDessin.TypeEtape != null && objetDessin.TypeEtape.Bloc != null) { m_imageElementSelectionne.Visible = true; m_imageElementSelectionne.Image = objetDessin.TypeEtape.Bloc.BlocImage; bDrawInfo = true; } else { m_imageElementSelectionne.Visible = false; } IWorflowDessin dessin = m_panelWorkflow.Selection[0] as IWorflowDessin; if (dessin != null) { m_lblElementSelectionne.Text = dessin.Text; bDrawInfo = true; } m_panelInfoSelection.Visible = bDrawInfo; } else { m_panelInfoSelection.Visible = false; ArrayList lst = new ArrayList(); foreach (C2iObjetGraphique element in m_panelWorkflow.Selection) { lst.Add(element); } m_gridProprietes.SelectedObjects = lst.ToArray(); } }
private void AssurePositionOk() { IWorflowDessin objetSource = ObjetSource; IWorflowDessin objetDest = ObjetDest; if (!m_bPositionInvalide)//Vérifie que le départ et l'arrivé n'ont pas bougé { if (objetSource != null && objetSource.RectangleAbsolu != m_lastRectangleDepart || objetDest != null && objetDest.RectangleAbsolu != m_lastRectangleArrivee) { m_bPositionInvalide = true; } } if (m_bPositionInvalide) { Point pt1; if (objetSource == null) { pt1 = m_lastPointDepart; } else { m_lastRectangleDepart = objetSource.RectangleAbsolu; pt1 = GetCentreRect(m_lastRectangleDepart); } Point pt2; if (objetDest == null) { pt2 = m_lastPointArrivee; } else { m_lastRectangleArrivee = objetDest.RectangleAbsolu; pt2 = GetCentreRect(m_lastRectangleArrivee); } m_lienTracable = CTraceurLienDroit.GetLien(pt1, pt2, OutStyle); if (objetSource != null) { Point[] pts1 = objetSource.GetPolygoneDessin(); //Suppression des segments inutiles int nLastIntersect = 0; CSegmentDroite[] segments = m_lienTracable.Segments; for (nLastIntersect = segments.Count() - 1; nLastIntersect > 0; nLastIntersect--) { Point dummy = new Point(0, 0); if (segments[nLastIntersect].GetIntersectionPoint(pts1, ref dummy)) { break; } } for (int n = 0; n < nLastIntersect; n++) { m_lienTracable.RemovePoint(0); } if (m_lienTracable.Points.Count() > 1) { CSegmentDroite segment = new CSegmentDroite(m_lienTracable.Points.ElementAt(0), m_lienTracable.Points.ElementAt(1)); if (segment.GetIntersectionPoint(pts1, ref pt1)) { m_lienTracable.RemplacePoint(0, pt1); } } } if (objetDest != null) { Point[] pts2 = objetDest.GetPolygoneDessin(); //Suppression des segments inutiles CSegmentDroite[] segments = m_lienTracable.Segments; int nLastIntersect = segments.Count() - 1; for (nLastIntersect = 0; nLastIntersect < segments.Count() - 1; nLastIntersect++) { Point dummy = new Point(0, 0); if (segments[nLastIntersect].GetIntersectionPoint(pts2, ref dummy)) { break; } } for (int n = nLastIntersect + 1; n < segments.Count(); n++) { m_lienTracable.RemovePoint(m_lienTracable.Points.Count() - 1); } if (m_lienTracable.Points.Count() > 1) { CSegmentDroite segment = new CSegmentDroite( m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 2), m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 1)); if (segment.GetIntersectionPoint(pts2, ref pt2)) { m_lienTracable.RemplacePoint(m_lienTracable.Points.Count() - 1, pt2); } } } m_lastPointDepart = m_lienTracable.Points.ElementAt(0);; m_lastPointArrivee = m_lienTracable.Points.ElementAt(m_lienTracable.Points.Count() - 1); m_bPositionInvalide = false; } }
private void ShowInterfaceLienAction(IWorflowDessin start, IWorflowDessin end) { /* m_sourceLienParametre = start; * m_destLienParametre = end;*/ }