Example #1
0
 //-------------------------------------------------------
 public override void Draw(CContextDessinObjetGraphique ctx)
 {
     base.Draw(ctx);
     if (SourceEntites is CSourceEntitesPourTableDataChampDeTable)
     {
         string            strIdTable  = ((CSourceEntitesPourTableDataChampDeTable)SourceEntites).IdTable;
         IObjetDeEasyQuery tableSource = null;
         foreach (IObjetDeEasyQuery objet in Query.Childs)
         {
             CODEQBase o = objet as CODEQBase;
             if (o != null && o.Id == strIdTable)
             {
                 tableSource = o;
                 break;
             }
         }
         if (tableSource != null)
         {
             Pen           pen  = new Pen(Brushes.Black, 2);
             CLienTracable lien = CTraceurLienDroit.GetLienPourLier(tableSource.RectangleAbsolu, RectangleAbsolu, EModeSortieLien.Automatic);
             lien.RendVisibleAvecLesAutres(ctx.Liens);
             ctx.AddLien(lien);
             pen.DashStyle = DashStyle.Dot;
             AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
             pen.CustomEndCap = cap;
             lien.Draw(ctx.Graphic, pen);
             pen.Dispose();
             cap.Dispose();
         }
     }
 }
Example #2
0
        private void drawArrow(Graphics g, int x, int y, int x2, int y2)
        {
            Pen p = new Pen(Color.Black, 2);//此处设置颜色和宽度
            AdjustableArrowCap aac = new AdjustableArrowCap(5, 5);

            //p.CustomStartCap = aac;
            p.CustomEndCap = aac;
            g.DrawLine(p, x, y, x2, y2);
            p.Dispose();
            aac.Dispose();
        }
        //------------------------------------------------------------------------
        public virtual void DrawExpression(CContextDessinObjetGraphique ctx, CRepresentationExpressionGraphique expressionGraphique)
        {
            Rectangle rct = expressionGraphique.RectangleAbsolu;
            if ( expressionGraphique.LastErreur != null && expressionGraphique.LastErreur != "" )
                ctx.Graphic.FillRectangle(Brushes.Red, rct);
            else
                ctx.Graphic.FillRectangle(Brushes.White, rct);
            ctx.Graphic.DrawRectangle(Pens.Black, rct);

            C2iExpressionAnalysable expAn = expressionGraphique.Formule as C2iExpressionAnalysable;
            string strText = "";
            /*if (expAn != null)
                strText = expAn.GetInfos().Texte;
            else */if ( expressionGraphique.Formule != null )
                strText = expressionGraphique.Formule.GetString();
            StringFormat f = new StringFormat();
            f.Alignment = StringAlignment.Center;
            f.LineAlignment = StringAlignment.Center;

            Font ft = new Font(FontFamily.GenericSansSerif, 8);
            ctx.Graphic.DrawString(strText, ft, Brushes.Black, expressionGraphique.RectangleAbsolu, f);

            AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
            C2iExpressionGraphique rep = expressionGraphique.RepresentationRacine;
            if (rep != null)
            {
                Pen pen = new Pen(Brushes.Black, 1);
                pen.DashStyle = DashStyle.Dot;
                pen.EndCap = LineCap.Custom;
                
                pen.CustomEndCap = cap;
                foreach (string strLien in expressionGraphique.IdElementsUtilises)
                {
                    CRepresentationExpressionGraphique exp = rep.GetFormule(strLien);
                    if (exp != null)
                    {
                        DrawLien(ctx, pen, ft, exp, expressionGraphique, "");
                    }
                }
                pen.Dispose();
                
            }

            CRepresentationExpressionGraphique next = expressionGraphique.Next;
            if (next != null)
            {
                Pen pen = new Pen(Brushes.Black, 3);
                pen.CustomEndCap = cap;
                DrawLien(ctx, pen, ft, expressionGraphique, next, "");
                pen.Dispose();
            }
            cap.Dispose();
            ft.Dispose();
        }
Example #4
0
        private void DrawLine(Graphics g, GraphicsPath lineToDraw)
        {
            Pen myPen = new Pen(Color.Green, 1);


            AdjustableArrowCap myArrow = new AdjustableArrowCap(4, 4, true);

            myPen.CustomEndCap = myArrow;

            g.DrawPath(myPen, lineToDraw);

            myPen.Dispose();

            myArrow.Dispose();
        }
Example #5
0
        /// <summary>
        /// Draws the arrow.
        /// </summary>
        /// <param name="color">The color.</param>
        /// <param name="rx">The rx.</param>
        /// <param name="ry">The ry.</param>
        private void DrawArrow(Color color, int rx, int ry)
        {
            Rectangle R = new Rectangle(rx + 8, ry + 8, 16, 16);

            G.SmoothingMode = SmoothingMode.AntiAlias;

            Pen P = new Pen(color, 1);
            AdjustableArrowCap C = new AdjustableArrowCap(3, 2);

            P.CustomEndCap = C;

            G.DrawArc(P, R, 0f, 290f);

            P.Dispose();
            C.Dispose();
            G.SmoothingMode = SmoothingMode.None;
        }
Example #6
0
        //---------------------------------------------------
        protected override void MyDraw(CContextDessinObjetGraphique ctx)
        {
            base.MyDraw(ctx);
            IObjetDeEasyQuery source = TableSource;

            if (source != null)
            {
                Pen           pen  = new Pen(Brushes.Black, 2);
                CLienTracable lien = CTraceurLienDroit.GetLienPourLier(source.RectangleAbsolu, RectangleAbsolu, EModeSortieLien.Automatic);
                lien.RendVisibleAvecLesAutres(ctx.Liens);
                ctx.AddLien(lien);
                AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
                pen.CustomEndCap = cap;
                lien.Draw(ctx.Graphic, pen);
                pen.Dispose();
                cap.Dispose();
            }
        }
Example #7
0
 //----------------------------------------------------------------------------------------
 public void Draw(IObjetDeEasyQuery objetPossedant, CContextDessinObjetGraphique ctxDessin)
 {
     if (objetPossedant != null && objetPossedant.Query != null)
     {
         IObjetDeEasyQuery objet = objetPossedant.Query.GetObjet(SourceTableId);
         if (objet != null)
         {
             Color c   = Color.FromArgb(128, 0, 0, 255);
             Pen   pen = new Pen(c, 1);
             AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
             pen.CustomEndCap = cap;
             CLienTracable lien = CTraceurLienDroit.GetLienPourLier(objet.RectangleAbsolu, objetPossedant.RectangleAbsolu, EModeSortieLien.Automatic);
             lien.RendVisibleAvecLesAutres(ctxDessin.Liens);
             ctxDessin.AddLien(lien);
             lien.Draw(ctxDessin.Graphic, pen);
             pen.Dispose();
             cap.Dispose();
         }
     }
 }
        public void Draw(Graphics g, Point location, Size mapSize)
        {
            var imageTip = Tip.Scale(mapSize).Translate(location).ToPoint();
            var imageEnd = End.Scale(mapSize).Translate(location).ToPoint();

            // shorten the arrow on one side so it doesn't overlap with the planet
            if (IsArrow && !IsColonyLink)
            {
                Shorten(imageEnd, ref imageTip);
            }

            using (var brush = new LinearGradientBrush(imageTip, imageEnd, TipColor, EndColor))
                //using (var brush = new SolidBrush(Color.Red))
                using (var pen = new Pen(brush, LineWidth * mapSize.Width)) {
                    CustomLineCap cap;
                    if (IsArrow)
                    {
                        if (IsColonyLink)
                        {
                            pen.CustomEndCap = PenCapProvider.GetInheritanceRepresentation();
                            g.DrawLines(pen, new[] { imageTip, imageEnd });
                        }
                        else
                        {
                            cap = new AdjustableArrowCap(10, 12);
                            pen.CustomStartCap = cap;
                            g.DrawLines(pen, new[] { imageTip, imageEnd });
                            cap.Dispose();
                        }
                    }
                    else
                    {
                        g.DrawLines(pen, new[] { imageTip, imageEnd });
                    }
                }
        }
Example #9
0
    private void DrawArrow(Color color, int rx, int ry)
    {
        Rectangle R = new Rectangle(rx + 8, ry + 8, 16, 16);
        G.SmoothingMode = SmoothingMode.AntiAlias;

        Pen P = new Pen(color, 1);
        AdjustableArrowCap C = new AdjustableArrowCap(3, 2);
        P.CustomEndCap = C;

        G.DrawArc(P, R, 0f, 290f);

        P.Dispose();
        C.Dispose();
        G.SmoothingMode = SmoothingMode.None;
    }
Example #10
0
        public override void DrawExpression(CContextDessinObjetGraphique ctx, CRepresentationExpressionGraphique expressionGraphique)
        {
            Rectangle rct = expressionGraphique.RectangleAbsolu;

            List<Point> pts = new List<Point>();
            pts.Add(new Point(rct.Left, rct.Top + rct.Height / 2));
            pts.Add(new Point(rct.Left + rct.Width / 2, rct.Top));
            pts.Add(new Point(rct.Right, rct.Top + rct.Height / 2));
            pts.Add(new Point(rct.Left + rct.Width / 2, rct.Bottom));
            ctx.Graphic.FillPolygon(Brushes.White, pts.ToArray());
            ctx.Graphic.DrawPolygon(Pens.Black, pts.ToArray());

            C2iExpressionAnalysable expAn = expressionGraphique.Formule as C2iExpressionAnalysable;
            
            string strText = "";
            if (expAn.Parametres.Count >0 && expAn.Parametres[0] != null)
            {
                strText = expAn.Parametres2i[0].GetString();
            }
            else
            {

                if (expAn != null)
                    strText = expAn.GetInfos().Texte;
                else if (expressionGraphique.Formule != null)
                    strText = expressionGraphique.Formule.GetString();
            }
            StringFormat f = new StringFormat();
            f.Alignment = StringAlignment.Center;
            f.LineAlignment = StringAlignment.Center;

            Font ft = new Font(FontFamily.GenericSansSerif, 8);
            ctx.Graphic.DrawString(strText, ft, Brushes.Black, expressionGraphique.RectangleAbsolu, f);


            C2iExpressionGraphique rep = expressionGraphique.RepresentationRacine;
            AdjustableArrowCap cap = new AdjustableArrowCap(4, 4, true);
            if (rep != null)
            {
                
                Pen pen = new Pen ( Color.Black, 2 );
                pen.CustomEndCap = cap;
                for ( int n = 0; n< 3; n++ )
                {
                    
                    CRepresentationExpressionGraphique ext = expressionGraphique.GetExterne ( n );
                    if ( ext != null )
                    {
                        if ( n == 0 )
                        {
                            pen.Color = Color.Black;
                            pen.Width = 1;
                            pen.DashStyle = DashStyle.Dot;
                            DrawLien ( ctx, pen, ft, ext, expressionGraphique, "?" );
                        }
                        else if (n == 1)
                        {
                            pen.Width = 3;
                            pen.DashStyle = DashStyle.Solid;
                            pen.Color = Color.Green;
                            DrawLien(ctx, pen, ft, expressionGraphique, ext, I.T("Yes|20082"));
                        }
                        else if (n == 2)
                        {
                            pen.Width = 3;
                            pen.DashStyle = DashStyle.Solid;
                            pen.Color = Color.Red;
                            DrawLien(ctx, pen, ft, expressionGraphique, ext, I.T("no|20083"));
                        }
                    }
                }
                pen.Dispose();
            }
            CRepresentationExpressionGraphique next = expressionGraphique.Next;
            if (next != null)
            {
                Pen pen = new Pen(Brushes.Black, 3);
                pen.CustomEndCap = cap;
                DrawLien(ctx, pen, ft, expressionGraphique, next, I.T("End if|20084"));
                pen.Dispose();
            }
            cap.Dispose();
            ft.Dispose();
        }
        //------------------------------------------------------------------------
        public override void DrawExpression(CContextDessinObjetGraphique ctx, CRepresentationExpressionGraphique expressionGraphique)
        {
            C2iExpressionObjet expObjet = expressionGraphique.Formule as C2iExpressionObjet;

            if (expObjet == null)
            {
                return;
            }

            Rectangle rct = expressionGraphique.RectangleAbsolu;

            Rectangle[] rcts = new Rectangle[] {
                new Rectangle(rct.Left, rct.Top, rct.Width, rct.Height / 2),
                new Rectangle(rct.Left, rct.Top + rct.Height / 2, rct.Width, rct.Height / 2)
            };
            //Dessin des deux paramètres
            for (int n = 0; n < 2; n++)
            {
                CRepresentationExpressionGraphique exp = new CRepresentationExpressionGraphique();
                exp.Position = new Point(rcts[n].Left, rcts[n].Top);
                exp.Size     = new Size(rcts[n].Width, rcts[n].Height);
                if (expObjet.Parametres.Count > n)
                {
                    exp.Formule = expObjet.Parametres2i[n];
                }
                CDessineurExpressionGraphique dessineur = CDessineurExpressionGraphique.GetDessineur(exp);
                if (dessineur != null)
                {
                    dessineur.DrawExpression(ctx, exp);
                }
            }



            StringFormat f = new StringFormat();

            f.Alignment     = StringAlignment.Center;
            f.LineAlignment = StringAlignment.Center;

            Font ft = new Font(FontFamily.GenericSansSerif, 8);

            AdjustableArrowCap     cap = new AdjustableArrowCap(4, 4, true);
            C2iExpressionGraphique rep = expressionGraphique.RepresentationRacine;

            if (rep != null)
            {
                Pen pen = new Pen(Brushes.DarkGreen, 1);
                pen.DashStyle = DashStyle.DashDotDot;
                pen.EndCap    = LineCap.Custom;

                pen.CustomEndCap = cap;
                foreach (string strLien in expressionGraphique.IdElementsUtilises)
                {
                    CRepresentationExpressionGraphique exp = rep.GetFormule(strLien);
                    if (exp != null)
                    {
                        DrawLien(ctx, pen, ft, exp, expressionGraphique, "");
                    }
                }
                pen.Dispose();
            }

            CRepresentationExpressionGraphique next = expressionGraphique.Next;

            if (next != null)
            {
                Pen pen = new Pen(Brushes.Black, 3);
                pen.CustomEndCap = cap;
                DrawLien(ctx, pen, ft, expressionGraphique, next, "");
                pen.Dispose();
            }
            cap.Dispose();
            ft.Dispose();
        }