コード例 #1
0
ファイル: Canvas.cs プロジェクト: Totriangle/Demo
        void DrawShape(Graphics g)
        {
            g.Clear(Color.Transparent);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            g.Transform = UserMatrix.initMatrix;

            GraphicsContainer drawContainer = g.BeginContainer();

            g.ScaleTransform(1 / GlobalZoomNum, 1 / GlobalZoomNum);

            CoordinateShape.Draw(g);
            MouseShape.Draw(g);
            g.EndContainer(drawContainer);
        }
コード例 #2
0
        /// <summary>
        /// 原始界面画图
        /// </summary>
        public static void DrawShap()
        {
            try
            {
                bGrp.Graphics.Clear(Color.Black);

                bGrp.Graphics.Transform = TransformMatrix.initMatrix;

                GraphicsContainer drawContainer = bGrp.Graphics.BeginContainer();
                bGrp.Graphics.ScaleTransform(1 / globalZoomNum, 1 / globalZoomNum);

                foreach (BaseShape item in currentShapes)
                {
                    if (!"Text".Equals(item.ShapeClass))
                    {
                        item.Draw(bGrp.Graphics);
                    }
                }

                if (nowStock.StockForm.Count > 0)
                {
                    foreach (BaseShape item in nowStock.StockForm)
                    {
                        item.Draw(bGrp.Graphics);
                    }
                }

                foreach (BaseModel item in currentPlates)
                {
                    item.Draw(bGrp.Graphics);
                }

                //SnapPointShape.Draw(bGrp.Graphics);

                selectRect.Draw(bGrp.Graphics);

                CoordinateShape.Draw(bGrp.Graphics);

                MouseShape.Draw(bGrp.Graphics);

                bGrp.Graphics.EndContainer(drawContainer);

                //bGrp.Render();

                //bGrp.Dispose(); //这里释放资源,需要重新添加资源

                foreach (BaseShape item in currentShapes)
                {
                    if ("Text".Equals(item.ShapeClass))
                    {
                        item.Draw(bGrp.Graphics);
                    }
                }

                bGrp.Render();
            }
            catch (System.Exception e)
            {
                //MessageBox.Show("show show show");
            }
        }