/// <summary> /// replace the drawing by ID /// </summary> /// <param name="objDraw"></param> /// <returns>true: drawing is added; false: drawing is replaced</returns> public bool AddDrawing(DrawingItem objDraw) { if (objDraw != null) { bool bFound = false; for (int i = 0; i < this.Count; i++) { if (this[i] == objDraw || this[i].DrawingId == objDraw.DrawingId) { this[i] = objDraw; objDraw.LayerId = this.LayerId; //layer is determined by the layer id and the page bFound = true; break; } } if (!bFound) { Add(objDraw); objDraw.LayerId = this.LayerId; DrawingPage p = _drawingPage as DrawingPage; if (p != null) { objDraw.Page = p; } resetzorder(); _sorted = null; return(true); } } return(false); }
public override void OnDraw(Graphics g) { base.OnDraw(g); //draw rectangle DrawImage.DrawImageOnRect(g, getBackImage()); if (_items != null) { DrawingPage.VerifyDrawingOrder(_items, false); GraphicsState gs = g.Save(); if (RotateAngle != 0) { double angle = (RotateAngle / 180) * Math.PI; Rectangle rc = this.Rectangle; g.TranslateTransform( (rc.Width + (float)(rc.Height * Math.Sin(angle)) - (float)(rc.Width * Math.Cos(angle))) / 2 + rc.X, (rc.Height - (float)(rc.Height * Math.Cos(angle)) - (float)(rc.Width * Math.Sin(angle))) / 2 + rc.Y); g.RotateTransform((float)RotateAngle); } else { g.TranslateTransform((float)(this.Left), (float)(this.Top)); } for (int i = 0; i < _items.Count; i++) { DrawingItem item = _items[i]; if (item.Visible) { item.OnDraw(g); } } g.Restore(gs); } }
private void SizeChanged_53e488c2(object sender0, System.EventArgs e) { Limnor.Drawing2D.DrawingPage sender = ((Limnor.Drawing2D.DrawingPage)(sender0)); if ((this.WindowState == System.Windows.Forms.FormWindowState.Minimized)) { this.Hide(); } }
protected override void OnParentChanged(EventArgs e) { if (Item != null) { DrawingPage p = Parent as DrawingPage; if (p != null) { Item.Page = p; } } base.OnParentChanged(e); }
public void OnChildZOrderChanged(IDrawDesignControl itemControl) { IDrawingHolder h = _item as IDrawingHolder; if (h != null) { h.RefreshDrawingOrder(); DrawingPage.RefreshDrawingDesignControlZOrders(this, null); Form f = this.FindForm(); if (f != null) { f.Invalidate(); } } }
protected override void OnParentChanged(EventArgs e) { if (Item != null) { DrawingPage p = Parent as DrawingPage; if (p != null) { Item.Page = p; } else { Draw2DGroupBox ddg = Parent as Draw2DGroupBox; if (ddg != null) { ddg.OnAddDrawingItem(Item); } } } base.OnParentChanged(e); }
public void VerifyItemOrders() { DrawingPage.VerifyDrawingOrder(this, false); }
public LayerHolder(DrawingPage page) { _page = page; }
public DesignBehaviorDrawing2D(DrawingPage page, BehaviorService behaviorService) { _page = page; _behaviorService = behaviorService; }
public void RefreshDrawingOrder() { DrawingPage.VerifyDrawingOrder(_items, false); }