コード例 #1
0
 /// <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);
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
 protected override void OnParentChanged(EventArgs e)
 {
     if (Item != null)
     {
         DrawingPage p = Parent as DrawingPage;
         if (p != null)
         {
             Item.Page = p;
         }
     }
     base.OnParentChanged(e);
 }
コード例 #5
0
        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();
                }
            }
        }
コード例 #6
0
 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);
 }
コード例 #7
0
 public void VerifyItemOrders()
 {
     DrawingPage.VerifyDrawingOrder(this, false);
 }
コード例 #8
0
 public LayerHolder(DrawingPage page)
 {
     _page = page;
 }
コード例 #9
0
 public DesignBehaviorDrawing2D(DrawingPage page, BehaviorService behaviorService)
 {
     _page            = page;
     _behaviorService = behaviorService;
 }
コード例 #10
0
 public void RefreshDrawingOrder()
 {
     DrawingPage.VerifyDrawingOrder(_items, false);
 }