/// <summary> /// Invalidates <em>this</em> layer over the given Region. (In 1x1 space.) /// </summary> public void Invalidate(Region region) { if (this.Substrate != null) { System.Drawing.Region r = null; try { r = new System.Drawing.Region(region.GetRegionData()); r.Transform(InvertMatrix(this.To1x1Transform)); if (this.Substrate.InvokeRequired) { this.Substrate.Invoke(new SubstrateInvalidateDelegate(SubstrateInvalidate), new object[] { r }); } else { this.Substrate.Invalidate(r); } } catch (System.ArgumentException ex) { // This happened once during live stream playback // apparently inside the Invert operation above. Debug.WriteLine(ex.ToString()); } catch (InvalidOperationException ex) { // This can happen due to a GDI+ threading issue when trying to clone a Transform. "Object is in use elsewhere." Debug.WriteLine(ex.ToString()); } finally { if (r != null) { r.Dispose(); } } } this.OnInvalidated(new RegionEventArgs(region)); }
private void RotateRegion(Region g, float angle) { //technically mirror, not rotate using (Matrix m = new Matrix()) { rc = this.ClientRectangle; m.Translate((float)rc.Width, 0);//(angle, new PointF(rc.Left + (rc.Width / 2), //rc.Top + (rc.Height / 2))); m.Scale(-1, 1); g.Transform(m); } }
public void TransformRegion(Graphics g) { Pen myPen = new Pen(Color.FromArgb(196, 0xC3, 0xC9, 0xCF), (float)0.6); SolidBrush myBrush = new SolidBrush(Color.FromArgb(127, 0xDD, 0xDD, 0xF0)); // Create the first rectangle and draw it to the screen in blue. Rectangle regionRect = new Rectangle(100, 50, 100, 100); g.DrawRectangle(myPen, regionRect); g.FillRectangle (myBrush, regionRect); // Create a region using the first rectangle. Region myRegion = new Region(regionRect); // Create a transform matrix and set it to have a 45 degree // rotation. Matrix transformMatrix = new Matrix(); transformMatrix.RotateAt(45, new Point(100, 50)); // Apply the transform to the region. myRegion.Transform(transformMatrix); // Fill the transformed region with red and draw it to the screen // in color. myBrush.Color = Color.FromArgb(127, 0x66, 0xEF, 0x7F); myPen.Color = Color.FromArgb(255, 0, 0x33, 0); g.FillRegion(myBrush, myRegion); title = "TransformRegion"; }
private void DrawDotDensity(ref Graphics g, Theme _Theme, Matrix mTransMatrix, RectangleF CurExt) { int DotCount; int DotSize = (int)_Theme.DotSize; double DotValue = _Theme.DotValue; Brush BrDot = new SolidBrush(_Theme.DotColor); Pen PnDot = new Pen(_Theme.DotColor); PointF[] Pt = new PointF[1]; int j; int TrialCount; Shape _Shape; GraphicsPath gpShp = new GraphicsPath(); RectangleF RectRnd = new RectangleF(); Matrix _Matrix = new Matrix(); StringFormat _StringFormat = new StringFormat(); _StringFormat.Alignment = StringAlignment.Center; _StringFormat.LineAlignment = StringAlignment.Center; _StringFormat.FormatFlags = StringFormatFlags.NoClip; Theme _ATheme = m_Themes.GetActiveTheme(); bool bLayerVisibility; g.SmoothingMode = SmoothingMode.AntiAlias; //*** Traverse Layers collection foreach (Layer _Layer in Layers) { if (DotValue == 0) break; if ((_ATheme == null)) { bLayerVisibility = _Layer.Visible; } else { bLayerVisibility = (bool)(_ATheme.LayerVisibility[_Layer.ID]); } //*** Consider polygon layers lying within current map extent and visibility is on if (_Layer.LayerType == ShapeType.Polygon & _Layer.Extent.IntersectsWith(CurExt) & bLayerVisibility) { //Render layer only if it lies within current map extent Hashtable ht = _Layer.GetRecords(_Layer.LayerPath + "\\" + _Layer.ID); IDictionaryEnumerator dicEnumerator = ht.GetEnumerator(); //*** Traverse each Shape of the layer while (dicEnumerator.MoveNext()) { _Shape = (Shape)dicEnumerator.Value; //*** Consider shape only if it lies within current map extent if (_Shape.Extent.IntersectsWith(CurExt)) { if (_Theme.AreaIndexes.ContainsKey(_Shape.AreaId)) { DotCount = (int)((double)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).DataValue / DotValue); Region Rgn = new Region(); RectangleF[] Rect; PointF[] Vertex = new PointF[3]; //*** for triangle object MarkerSize = Math.Sqrt(3) / 4 * DotSize; //*** for triangle if (DotCount > 0) { gpShp.Reset(); for (j = 0; j <= _Shape.Parts.Count - 1; j++) { gpShp.AddPolygon((PointF[])_Shape.Parts[j]); } Rgn = new Region(gpShp); //Rgn.Intersect(CurExt) Rgn.Transform(mTransMatrix); Rect = Rgn.GetRegionScans(_Matrix); //http://www.dotnet247.com/247reference/a.aspx?u=http://www.bobpowell.net/gdiplus_faq.htm //Rect.Sort(Rect) } else { Rect = new RectangleF[0]; // Rect[] length is set to 0 because Rect.length was required in If condition below. } //*** Draw random dots inside region j = 1; TrialCount = 1; //*** Bugfix / Enhancement 19 Jun 2006 Distribution of Dots while (j <= DotCount) { if (DotCount == 0) break; if (Rect.Length == 0) break; VBMath.Randomize(); try { if (Rect.Length / 2 > j + 1) { if ((double)j / 2 == (int)(j / 2)) //Math.Round((double)(j / 2))) { if ((double)j / 8 == Math.Round((double)(j / 8))) { RectRnd = Rect[j]; } else { RectRnd = Rect[(int)(Rect.Length / 2) - j]; } } else { if ((double)j / 6 == Math.Round((double)(j / 6))) { RectRnd = Rect[Rect.Length - j]; } else { RectRnd = Rect[(int)(Rect.Length / 2) + j]; } } } else { RectRnd = Rect[(int)(VBMath.Rnd() * (Rect.Length - 1))]; } } catch (Exception ex) { Console.Write(ex.Message); } Pt[0].X = RectRnd.X + RectRnd.Width * (float)(0.6 * (float)VBMath.Rnd() + 0.2); Pt[0].Y = RectRnd.Y - RectRnd.Height / 2; //* Rnd() if (Rgn.IsVisible(Pt[0])) { switch (_Theme.DotStyle) { case MarkerStyle.Circle: g.FillEllipse(BrDot, (int)(Pt[0].X - DotSize / 2), (int)(Pt[0].Y - DotSize / 2), (int)DotSize, (int)DotSize); break; case MarkerStyle.Square: g.FillRectangle(BrDot, (int)(Pt[0].X - DotSize / 2), (int)(Pt[0].Y - DotSize / 2), (int)DotSize, (int)DotSize); break; case MarkerStyle.Triangle: Vertex[0] = new PointF(Pt[0].X - float.Parse(MarkerSize.ToString()), Pt[0].Y + float.Parse(MarkerSize.ToString())); Vertex[1] = new PointF(Pt[0].X + float.Parse(MarkerSize.ToString()), Pt[0].Y + float.Parse(MarkerSize.ToString())); Vertex[2] = new PointF(Pt[0].X, Pt[0].Y - float.Parse(MarkerSize.ToString())); g.FillPolygon(BrDot, Vertex); break; case MarkerStyle.Cross: g.DrawLine(PnDot, (int)(Pt[0].X - DotSize / 2), (int)Pt[0].Y, (int)(Pt[0].X + DotSize / 2), (int)Pt[0].Y); g.DrawLine(PnDot, (int)Pt[0].X, (int)(Pt[0].Y + DotSize / 2), (int)Pt[0].X, (int)(Pt[0].Y - DotSize / 2)); break; case MarkerStyle.Custom: g.DrawString(_Theme.DotChar.ToString(), _Theme.DotFont, BrDot, Pt[0].X, Pt[0].Y, _StringFormat); break; } j = j + 1; } if (TrialCount > DotCount + 2) break; TrialCount += 1; } Rgn.Dispose(); Rect = null; } } } ht = null; dicEnumerator = null; } // _Layer = null; } g.SmoothingMode = SmoothingMode.None; _Matrix = null; // RectRnd = null; Pt = null; // _Layer = null; _Shape = null; BrDot.Dispose(); PnDot.Dispose(); gpShp.Dispose(); _StringFormat.Dispose(); }
//Implement a base rendering of an element protected internal override void RenderShadow(Graphics graphics,IRender render) { if (mPoints == null) return; if (mPoints.Count < 2) return; PointF startLocation = (PointF) mPoints[0]; PointF startReference = (PointF) mPoints[1]; PointF endLocation = (PointF) mPoints[mPoints.Count-1]; PointF endReference = (PointF) mPoints[mPoints.Count-2]; Layer layer = this.Layer; Pen shadowPen = new Pen(layer.ShadowColor); GraphicsPath shadowPath = GetPathInternal(); shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity); //Save the current region Region current = graphics.Clip; //Mask out the start marker if (Start.Marker != null) { Region region = new Region(Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(Start.Marker,startLocation,startReference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } //Mask out the end marker if (End.Marker != null) { Region region = new Region(End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(End.Marker,endLocation,endReference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y); //Draw line if (Layer.SoftShadows) { shadowPen.Color = Color.FromArgb(20,shadowPen.Color); graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.SmoothingMode = SmoothingMode.HighQuality; } graphics.DrawPath(shadowPen, shadowPath); if (layer.SoftShadows) { graphics.CompositingQuality = render.CompositingQuality; graphics.SmoothingMode = SmoothingMode; } //Restore graphics if (Start.Marker != null || End.Marker != null) { graphics.Clip = current; if (Start.Marker != null) RenderMarkerShadow(Start.Marker,startLocation,startReference,graphics,render); if (End.Marker != null) RenderMarkerShadow(End.Marker,endLocation,endReference,graphics,render); } graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y); }
protected internal override void RenderAction(Graphics graphics, IRender render,IRenderDesign renderDesign) { if (mPoints == null || mPoints.Count < 2) return; PointF startLocation = (PointF) mPoints[0]; PointF startReference = (PointF) mPoints[1]; PointF endLocation = (PointF) mPoints[mPoints.Count-1]; PointF endReference = (PointF) mPoints[mPoints.Count-2]; //Save the current region Region current = graphics.Clip; //Mask out the start marker if (Start.Marker != null) { Region region = new Region(Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(Start.Marker,startLocation,startReference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Mask out the end marker if (End.Marker != null) { Region region = new Region(End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(End.Marker,endLocation,endReference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Render element action base.RenderAction (graphics,render,renderDesign); //Render markers if (Start.Marker != null || End.Marker != null) { graphics.Clip = current; if (Start.Marker != null) RenderMarkerAction(Start.Marker,startLocation,startReference,graphics,render,renderDesign); if (End.Marker != null) RenderMarkerAction(End.Marker,endLocation,endReference,graphics,render,renderDesign); } //Render any ports if (Ports != null) { foreach (Port port in Ports.Values) { if (port.Visible) { graphics.TranslateTransform(-Rectangle.X + port.Rectangle.X,-Rectangle.Y + port.Rectangle.Y); port.SuspendValidation(); port.Render(graphics, render); port.ResumeValidation(); graphics.TranslateTransform(Rectangle.X - port.Rectangle.X,Rectangle.Y - port.Rectangle.Y); } } } }
protected internal override void RenderAction(Graphics graphics,IRender render,IRenderDesign renderDesign) { if (Points == null) return; PointF location; PointF reference; Segment segment = null; //Save the current region Region current = graphics.Clip; //Mask out each marker for (int i=0; i<Points.Count-1; i++) { location = (PointF) Points[i]; reference = (PointF) Points[i+1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Draw the path GraphicsPath path = GetPathInternal(); if (path == null) return; if (renderDesign.ActionStyle == ActionStyle.Default) { Pen pen = new Pen(render.AdjustColor(BorderColor,BorderWidth,Opacity)); pen.Width = BorderWidth; graphics.DrawPath(pen,path); } else { graphics.DrawPath(Component.Instance.ActionPen,path); } //Reset the clip graphics.Clip = current; //Render the markers for (int i=0;i<Points.Count-1;i++) { segment = Segments[i]; location = (PointF) Points[i]; reference = (PointF) Points[i+1]; if (segment.Start.Marker != null) RenderMarkerAction(segment.Start.Marker,location,reference,graphics,render,renderDesign); } //Render final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; RenderMarkerAction(segment.End.Marker,location,reference,graphics,render,renderDesign); } }
void DrawToBitmap(MapDisplay mapdisplay, RectangleF clip) { Matrix inverse = transform.Clone(); inverse.Invert(); using (Region clipRegion = new Region(clip)) { clipRegion.Transform(inverse); mapdisplay.Draw(bitmap, transform, clipRegion); } }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; ProgressBarPath MyPath = new ProgressBarPath(); MyPath = GetPath(this.DisplayRectangle, true); if ((this.BackgroundImage != null)) { e.Graphics.DrawImage(this.BackgroundImage, this.DisplayRectangle); } //Call the appropriate Paint Method to draw the bar switch (BarType) { case eBarType.Bar: if (Value > 0) { PaintBar(e); } break; case eBarType.CylonBar: PaintCylonBar(e); break; case eBarType.CylonGlider: PaintCylonGlider(e); break; } //Create the Border Graphicspath and Draw it if (Border) { Pen MyPen = new Pen(BorderColor, BorderWidth); MyPen.Alignment = PenAlignment.Inset; var _with1 = MyPath; if (Shape == eShape.Text) { if (ShapeTextRotate != eRotateText.None) { Matrix mtrx = new Matrix(); mtrx.Rotate(GetRotateAngle(ShapeTextRotate)); _with1.Path.Transform(mtrx); } e.Graphics.Transform = TextMatrix(MyPath); } e.Graphics.DrawPath(MyPen, _with1.Path); e.Graphics.ResetTransform(); MyPen.Dispose(); } //Make a Region from the Graphicspath to clip the shape this.Region = null; if (Border) if (BorderWidth == 1) MyPath = GetPath(this.DisplayRectangle, false); Region mRegion = null; if (Shape == eShape.Text) { if (ShapeTextRotate != eRotateText.None) { Matrix mtrx = new Matrix(); mtrx.Rotate(GetRotateAngle(ShapeTextRotate)); MyPath.Path.Transform(mtrx); } mRegion = new Region(MyPath.Path); mRegion.Transform(TextMatrix(MyPath)); } else { mRegion = new Region(MyPath.Path); } this.Region = mRegion; mRegion.Dispose(); //Add the Text if (this.TextShow != eTextShow.None & this.TextPlacement == eTextPlacement.OverBar) PutText(e, this.DisplayRectangle); }
protected internal override void Render(Graphics graphics, IRender render) { if (Points == null) return; PointF location; PointF reference; Segment segment = null; //Save the current region Region current = graphics.Clip; //Mask out each marker for (int i=0;i<Points.Count-1;i++) { location = (PointF) Points[i]; reference = (PointF) Points[i+1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null && !segment.Start.Marker.DrawBackground) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null && !segment.End.Marker.DrawBackground) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix())); graphics.SetClip(region,CombineMode.Exclude); } //Draw the path Pen pen = null; if (CustomPen == null) { pen = new Pen(BorderColor,BorderWidth); pen.DashStyle = BorderStyle; //Check if winforms renderer and ajdust color as required pen.Color = render.AdjustColor(BorderColor,BorderWidth,Opacity); } else { pen = CustomPen; } graphics.DrawPath(pen,GetPathInternal()); //Reset the clip graphics.Clip = current; //Render the segment items for (int i=0;i<Points.Count-1;i++) { segment = Segments[i]; location = (PointF) Points[i]; reference = (PointF) Points[i+1]; if (segment.Start.Marker != null) RenderMarker(segment.Start.Marker,location,reference,graphics,render); //Render the segment image and annotation RenderSegment(segment,location,reference,graphics,render); } //Render final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; RenderMarker(segment.End.Marker,location,reference,graphics,render); } }
public void InfinityRotate () { using (Region r = new Region ()) { Assert.IsTrue (r.IsInfinite (graphic), "before"); using (Matrix m = new Matrix ()) { m.Rotate (45); r.Transform (m); } Assert.IsTrue (r.IsInfinite (graphic), "after"); CheckEmpty ("InfinityRotate", r); } }
public void InfinityScaleDown () { using (Region r = new Region ()) { Assert.IsTrue (r.IsInfinite (graphic), "before"); using (Matrix m = new Matrix ()) { m.Scale (0.5f, 0.5f); r.Transform (m); } Assert.IsTrue (r.IsInfinite (graphic), "after"); CheckEmpty ("InfinityScaleDown", r); } }
public void InfinityIntersectTransform () { using (Region r = new Region ()) { Assert.IsTrue (r.IsInfinite (graphic), "before"); r.Intersect (new Rectangle (-10, -10, 20, 20)); using (Matrix m = new Matrix (2, 0, 0, 0.5f, 10, 10)) { r.Transform (m); } RectangleF bounds = r.GetBounds (graphic); Assert.AreEqual (-10, bounds.X, "X"); Assert.AreEqual (5, bounds.Y, "Y"); Assert.AreEqual (40, bounds.Width, "Width"); Assert.AreEqual (10, bounds.Height, "Height"); } }
private void InvalidateTransform(Region region) { Matrix mx = new Matrix(); mx.Scale(scaleFactor, scaleFactor); mx.Translate(-hScrollBar.Value, -vScrollBar.Value); region.Transform(mx); Invalidate(region); }
protected internal override void RenderShadow(Graphics graphics, IRender render) { if (Points == null) return; PointF location; PointF reference; Segment segment = null; Layer layer = this.Layer; Pen shadowPen = new Pen(layer.ShadowColor); GraphicsPath shadowPath = GetPathInternal(); shadowPen.Color = render.AdjustColor(layer.ShadowColor,0,this.Opacity); //Save the current region Region current = graphics.Clip; //Mask out each marker for (int i=0;i<Points.Count-1;i++) { location = (PointF) Points[i]; reference = (PointF) Points[i+1]; segment = Segments[i]; //Mask out the start marker if (segment.Start.Marker != null) { Region region = new Region(segment.Start.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.Start.Marker,location,reference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } } //Mask out final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; Region region = new Region(segment.End.Marker.GetPathInternal()); region.Transform(GetMarkerTransform(segment.End.Marker,location,reference,new Matrix())); region.Translate(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.SetClip(region,CombineMode.Exclude); } //Draw the path graphics.TranslateTransform(layer.ShadowOffset.X ,layer.ShadowOffset.Y); graphics.DrawPath(shadowPen,shadowPath); //Reset the clip graphics.Clip = current; //Render the markers for (int i=0;i<Points.Count-1;i++) { segment = Segments[i]; location = (PointF) Points[i]; reference = (PointF) Points[i+1]; if (segment.Start.Marker != null) RenderMarkerShadow(segment.Start.Marker,location,reference,graphics,render); } //Render final marker if (segment.End.Marker != null) { location = (PointF) Points[Points.Count-1]; reference = (PointF) Points[Points.Count-2]; RenderMarkerShadow(segment.End.Marker,location,reference,graphics,render); } graphics.TranslateTransform(-layer.ShadowOffset.X ,-layer.ShadowOffset.Y); }
private void UpdateScaledRegion() { myScaledRegion = mySelectedRegion.Clone(); myScaledRegion.Transform( new System.Drawing.Drawing2D.Matrix( Image.ZoomScale, 0.0f, 0.0f, Image.ZoomScale, 0.0f, 0.0f ) ); }
internal void UpatePath(Graphics g) { if ((base.pretime != base.OwnerDocument.ControlTime) || (base.graphPath == null)||(base.IsChanged)) { PointF[] tfArray3; if (base.graphPath == null) { base.graphPath = new GraphicsPath(); } base.graphPath.Reset(); PointF tf1 = new PointF(this.X1, this.Y1); PointF tf2 = new PointF(this.X2, this.Y2); using (Matrix matrix1 = new Matrix()) { using (Matrix matrix2 = new Matrix()) { bool flag1 = false; bool flag2 = false; if (this.StartGraph != null) { flag1 = true; matrix1.Multiply(this.startGraph.Transform.Matrix); RectangleF ef1 = this.GetBounds(this.startGraph, matrix1); PointF tf3 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); PointF[] tfArray1 = (this.startGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.startGraphPointIndex >= 0) && (this.startGraphPointIndex < tfArray1.Length)) { flag1 = false; using (Matrix matrix3 = this.startGraph.Transform.Matrix.Clone()) { matrix3.TransformPoints(tfArray1); tf3 = tfArray1[this.startGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf3}; matrix5.TransformPoints(tfArray5); tf3=tfArray5[0]; } } tf1 = tf3; } if (this.EndGraph != null) { flag2 = true; matrix2.Multiply(this.endGraph.Transform.Matrix); RectangleF ef2 = this.GetBounds(this.endGraph, matrix2); PointF tf4 = new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f)); PointF[] tfArray2 =(this.endGraph as IGraph).ConnectPoints.Clone() as PointF[]; if ((this.endGraphPointIndex >= 0) && (this.endGraphPointIndex < tfArray2.Length)) { flag2 = false; using (Matrix matrix4 = this.endGraph.Transform.Matrix.Clone()) { matrix4.TransformPoints(tfArray2); tf4 = tfArray2[this.endGraphPointIndex]; } using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf4}; matrix5.TransformPoints(tfArray5); tf4=tfArray5[0]; } } tf2 = tf4; } if ((flag1 || flag2) && (this.startGraph != this.endGraph)) { PointF tf5 = tf1; PointF tf6 = tf2; using (GraphicsPath path1 = new GraphicsPath()) { path1.AddLine(tf1, tf2); path1.Widen(new Pen(Color.White, 0.1f)); if (flag1) { using (Region region1 = new Region(this.startGraph.GPath)) { region1.Transform(matrix1); region1.Intersect(path1); if (!region1.IsEmpty(g)) { tf5 = this.Intersect(region1.GetBounds(g), tf5); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf5}; matrix5.TransformPoints(tfArray5); tf5=tfArray5[0]; } } } } if (flag2) { using (Region region2 = new Region(this.endGraph.GPath)) { region2.Transform(matrix2); region2.Intersect(path1); if (!region2.IsEmpty(g)) { tf6 = this.Intersect(region2.GetBounds(g), tf6); using (Matrix matrix5 = this.Transform.Matrix.Clone()) { matrix5.Invert(); PointF[] tfArray5=new PointF[]{tf6}; matrix5.TransformPoints(tfArray5); tf6=tfArray5[0]; } } } } tf1 = tf5; tf2 = tf6; } } } } bool flag3 = Math.Abs( (tf2.Y - tf1.Y)) > Math.Abs((tf2.X - tf1.X)); string text1= base.SvgAttributes["type"].ToString().Trim(); this.type = (Enums.ConnectType)Enum.Parse(typeof(Enums.ConnectType),text1,true); switch (this.type) { case Enums.ConnectType.Line: { base.graphPath.AddLine(tf1, tf2); break; } case Enums.ConnectType.Polyline: { if (!flag3) { bool flag5 = tf1.X < tf2.X; tfArray3 = new PointF[] { tf1, new PointF(tf1.X + ((flag5 ? 1 : -1) * 30), tf1.Y), new PointF(tf2.X - ((flag5 ? 1 : -1) * 30), tf2.Y), tf2 }; base.graphPath.AddLines(tfArray3); break; } bool flag4 = tf1.Y < tf2.Y; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, tf1.Y + ((flag4 ? 1 : -1) * 30)), new PointF(tf2.X, tf2.Y - ((flag4 ? 1 : -1) * 30)), tf2 } ; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.RightAngle: { if (!flag3) { float single2 = (tf1.X + tf2.X) / 2f; tfArray3 = new PointF[] { tf1, new PointF(single2, tf1.Y), new PointF(single2, tf2.Y), tf2 } ; base.graphPath.AddLines(tfArray3); break; } float single1 = (tf1.Y + tf2.Y) / 2f; tfArray3 = new PointF[] { tf1, new PointF(tf1.X, single1), new PointF(tf2.X, single1), tf2 } ; base.graphPath.AddLines(tfArray3); break; } case Enums.ConnectType.Spline: { if (!flag3) { bool flag7 = tf1.X < tf2.X; base.graphPath.AddBezier(tf1, new PointF(tf1.X + ((flag7 ? 1 : -1) * 70), tf1.Y), new PointF(tf2.X - ((flag7 ? 1 : -1) * 70), tf2.Y), tf2); break; } bool flag6 = tf1.Y < tf2.Y; base.graphPath.AddBezier(tf1, new PointF(tf1.X, tf1.Y + ((flag6 ? 1 : -1) * 70)), new PointF(tf2.X, tf2.Y - ((flag6 ? 1 : -1) * 70)), tf2); break; } } tfArray3 = new PointF[] { tf1, tf2 } ; this.linepoints = tfArray3; // IsChanged=false; //base.pretime =this.OwnerDocument.ControlTime; } }