public override object Clone() { var pAct = new pActiveAnnotation(this.Bitmap, this.Location); pAct.Tag = Tag; return(pAct); }
public void ApplaypActiveCurve() { try { if (myInkCollector == null || myInkCollector.Ink.Strokes.Count == 0) { return; } myInkCollector.Enabled = false; System.IO.MemoryStream annms; Image AnnImg = null; try { //save New Annotaion byte[] b = myInkCollector.Ink.Save(PersistenceFormat.Gif); annms = new System.IO.MemoryStream(b); AnnImg = Image.FromStream(annms); annms.Close(); //try //{ // AnnImg.Save("C:\\hhhh.jpg" , System.Drawing.Imaging.ImageFormat.Gif); //} //catch //{ //} int letf = 0; int right = 0; Rectangle Rect = myInkCollector.Ink.Strokes[0].GetBoundingBox(Microsoft.Ink.BoundingBoxMode.Default); foreach (Stroke strk in myInkCollector.Ink.Strokes) { Rectangle recTemp = strk.GetBoundingBox(Microsoft.Ink.BoundingBoxMode.Default); if (recTemp.X < Rect.X) { Rect.X = recTemp.X; } if (recTemp.Y < Rect.Y) { Rect.Y = recTemp.Y; } } myInkCollector.Ink.Strokes[0].DrawingAttributes.Color = Color.Blue; System.Drawing.Point pointTopLeft = new System.Drawing.Point(Rect.Left, Rect.Top); System.Drawing.Point pointBottomRight = new System.Drawing.Point(Rect.Left, Rect.Top); pointBottomRight.Offset(Rect.Width, Rect.Height); myInkCollector.Renderer.InkSpaceToPixel(this.CreateGraphics(), ref pointTopLeft); myInkCollector.Renderer.InkSpaceToPixel(this.CreateGraphics(), ref pointBottomRight); double ll = Math.Truncate(this.drawingPanel1.ZoomFactor * 100000); float tt = (float)(100000 / ll); int x = (int)(pointTopLeft.X - this.drawingPanel1.BackgroundLayer.Location.X); int y = (int)(pointTopLeft.Y - this.drawingPanel1.BackgroundLayer.Location.Y); //int LocationX = (int)(x * tt); //int LocationY = (int)(y * tt); // Rectangle convertedRect = new Rectangle(x, //y, pointBottomRight.X - pointTopLeft.X, //pointBottomRight.Y - pointTopLeft.Y); Rectangle convertedRect = new Rectangle(pointTopLeft.X, pointTopLeft.Y, pointBottomRight.X - pointTopLeft.X, pointBottomRight.Y - pointTopLeft.Y); // Sbn.AdvancedControls.Imaging.SbnPaint.pActiveAnnotation pActiveSh1 = new Sbn.AdvancedControls.Imaging.SbnPaint.pActiveAnnotation((Bitmap)AnnImg, new PointF(convertedRect.X, convertedRect.Y)); //pActiveSh1.Dimension = new SizeF(new PointF(convertedRect.X, convertedRect.Y)); myInkCollector.Enabled = false; this.drawingPanel1.Shapes.Add(pActiveSh1); pActiveSh1.Selected = true; Strokes strokesToDelete = myInkCollector.Ink.Strokes; myInkCollector.Ink.DeleteStrokes(strokesToDelete); // Check to ensure that the ink collector isn't currently // in the middle of a stroke before clearing the ink. // Deleting a stroke that is currently being collected // will result in an error condition. } catch { } // myInkCollector = new InkCollector(); //this.Invalidate(false); } catch { } // tsbtnCurser.Checked = true; }
/// <summary> /// Copy constructor. /// </summary> /// <param name="rectangle">Rectangle to copy.</param> public pActiveAnnotation(pActiveAnnotation rectangle) : base(rectangle) { }