예제 #1
0
 protected override void PaintBody(DGraphics dg)
 {
     if (Alpha != 1)
     {
         dg.StartGroup(X, Y, Width, Height, 0, 0);
         PaintMetafile(dg);
         dg.DrawGroup(Alpha);
     }
     else
         PaintMetafile(dg);
 }
예제 #2
0
파일: Figure.cs 프로젝트: djpnewton/ddraw
 protected override void PaintBody(DGraphics dg)
 {
     if (UseRealAlpha)
     {
         if (Width > 0 && Height > 0)
         {
             DRect rS = GetSelectRect();
             dg.StartGroup(rS.X, rS.Y, rS.Width, rS.Height, 0, 0);
             foreach (Figure f in childFigs)
             {
                 f._controlScale = _controlScale;
                 f.GlyphsVisible = GlyphsVisible;
                 f.Paint(dg);
             }
             dg.DrawGroup(Alpha);
         }
     }
     else
         foreach (Figure f in childFigs)
         {
             f._controlScale = _controlScale;
             f.GlyphsVisible = GlyphsVisible;
             f.Paint(dg);
         }
 }
예제 #3
0
파일: Figure.cs 프로젝트: djpnewton/ddraw
        protected override void PaintBody(DGraphics dg)
        {
#if BEHAVIOURS
            // select paint properties
            DColor Fill = this.Fill;
            DColor Stroke = this.Stroke;
            double Alpha = this.Alpha;
            if (MouseOver)
            {
                if (MouseOverBehaviour.SetFill)
                    Fill = MouseOverBehaviour.Fill;
                if (MouseOverBehaviour.SetStroke)
                    Stroke = MouseOverBehaviour.Stroke;
                if (MouseOverBehaviour.SetAlpha)
                    Alpha = MouseOverBehaviour.Alpha;
            }
#endif
            // do painting
            if (UseRealAlpha && Alpha != 1 && StrokeWidth > 0)
            {
                dg.StartGroup(X, Y, Width + StrokeWidth, Height + StrokeWidth, SwHalf, SwHalf);
                dg.FillEllipse(X, Y, Width, Height, Fill);
                dg.DrawEllipse(X, Y, Width, Height, Stroke, 1, StrokeWidth, StrokeStyle);
                dg.DrawGroup(Alpha);
            }
            else
            {
                dg.FillEllipse(X, Y, Width, Height, Fill, Alpha);
                dg.DrawEllipse(X, Y, Width, Height, Stroke, Alpha, StrokeWidth, StrokeStyle);
            }
        }
예제 #4
0
파일: Figure.cs 프로젝트: djpnewton/ddraw
        protected override void PaintBody(DGraphics dg)
        {
#if BEHAVIOURS
            // select paint properties
            DColor Stroke = this.Stroke;
            double Alpha = this.Alpha;
            if (MouseOver)
            {
                if (MouseOverBehaviour.SetStroke)
                    Stroke = MouseOverBehaviour.Stroke;
                if (MouseOverBehaviour.SetAlpha)
                    Alpha = MouseOverBehaviour.Alpha;
            }
#endif
            // do painting
            if (Points != null && Points.Count > 1)
            {
                if (UseRealAlpha && Alpha != 1 && StrokeWidth > 0 && (StartMarker != DMarker.None || EndMarker != DMarker.None))
                {
                    DPoints smp;
                    if (StartMarker != DMarker.None)
                        smp = GetStartMarkerPoints();
                    else
                    {
                        if (Points.Count > 1)
                            smp = MarkerHelper.MarkerPoints(DMarker.Square, Points[0], Points[1], MarkerSize);
                        else
                            smp = new DPoints();
                    }
                    DPoints emp;
                    if (EndMarker != DMarker.None)
                        emp = GetEndMarkerPoints();
                    else
                    {
                        if (Points.Count > 1)
                            emp = MarkerHelper.MarkerPoints(DMarker.Square, Points[Points.Count - 1], Points[Points.Count - 2], MarkerSize);
                        else
                            emp = new DPoints();
                    }
                    DRect R = StrokeHelper.RectIncludingStrokeWidth(GetEncompassingRect(), StrokeWidth)
                        .Union(smp.Bounds()).Union(emp.Bounds());

                    dg.StartGroup(X, Y, R.Width, R.Height, X - R.X, Y - R.Y);
                    dg.DrawPolyline(Points, Stroke, 1, StrokeWidth, StrokeStyle, StrokeJoin, StrokeCap);
                    if (StartMarker != DMarker.None)
                        dg.FillPolygon(GetStartMarkerPoints(), Stroke, 1);
                    if (EndMarker != DMarker.None)
                        dg.FillPolygon(GetEndMarkerPoints(), Stroke, 1);
                    dg.DrawGroup(Alpha);
                }
                else
                {
                    dg.DrawPolyline(Points, Stroke, Alpha, StrokeWidth, StrokeStyle, StrokeJoin, StrokeCap);
                    if (StartMarker != DMarker.None)
                        dg.FillPolygon(GetStartMarkerPoints(), Stroke, Alpha);
                    if (EndMarker != DMarker.None)
                        dg.FillPolygon(GetEndMarkerPoints(), Stroke, Alpha);
                }
            }
        }
예제 #5
0
 protected override void PaintBody(DGraphics dg)
 {
     #if BEHAVIOURS
     // select paint properties
     DColor Fill = this.Fill;
     DColor Stroke = this.Stroke;
     double Alpha = this.Alpha;
     if (MouseOver)
     {
         if (MouseOverBehaviour.SetFill)
             Fill = MouseOverBehaviour.Fill;
         if (MouseOverBehaviour.SetStroke)
             Stroke = MouseOverBehaviour.Stroke;
         if (MouseOverBehaviour.SetAlpha)
             Alpha = MouseOverBehaviour.Alpha;
     }
     #endif
     // draw
     DPoints pts = DrawPoints();
     if (UseRealAlpha && Alpha != 1 && StrokeWidth > 0)
     {
         dg.StartGroup(X, Y, Width + StrokeWidth, Height + StrokeWidth, SwHalf, SwHalf);
         dg.FillPolygon(pts, Fill, 1);
         dg.DrawPolyline(pts, Stroke, 1, StrokeWidth, StrokeStyle, StrokeJoin, StrokeCap);
         dg.DrawGroup(Alpha);
     }
     else
     {
         dg.FillPolygon(pts, Fill, Alpha);
         dg.DrawPolyline(pts, Stroke, Alpha, StrokeWidth, StrokeStyle, StrokeJoin, StrokeCap);
     }
 }