Clone() public method

public Clone ( ) : object
return object
コード例 #1
0
ファイル: GraphicsExtension.cs プロジェクト: Gronzo/cchart
 public static void DrawArrow(this FakeGraphics.FakeGraphics g, Pen pen, int x1, int y1, int x2, int y2)
 {
     Pen p = (Pen)pen.Clone();
     p.StartCap = LineCap.Round;
     p.EndCap = LineCap.Flat;
     g.DrawLine(pen, x1, y1, x2, y2);
     p.Width = 5;
     p.EndCap = LineCap.ArrowAnchor;
     int xx=x2, yy=y2;
     if (x1 == x2)
     {
         if (y1 > y2)
             yy += 5;
         else
             yy -= 5;
     }
     else
     {
         if (x1 > x2)
             xx += 5;
         else
             xx -= 5;
     }
     g.DrawLine(p, xx, yy, x2, y2);
 }
コード例 #2
0
ファイル: ColorizationStyle.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the ColorizationStyle class.
 /// </summary>
 /// <param name="newFixationPen">The new fixation pen to set.</param>
 /// <param name="newConnectionPen">The new fixation connection pen to set.</param>
 /// <param name="newFont">The new font to set.</param>
 /// <param name="newFontColor">The new font color to set.</param>
 public ColorizationStyle(Pen newFixationPen, Pen newConnectionPen, Font newFont, Color newFontColor)
 {
   this.fixationPen = (Pen)newFixationPen.Clone();
   this.connectionPen = (Pen)newConnectionPen.Clone();
   this.font = (Font)newFont.Clone();
   this.fontColor = newFontColor;
 }
コード例 #3
0
ファイル: GestureThumbnail.cs プロジェクト: floatas/highsign
        public GestureThumbnail(PointF[] Points, Size Size, bool WithArrow)
        {
            _Points = Points;
            _Size = Size;
            _DrawingPen = new Pen(Properties.Settings.Default.MiniViewColor, 3);
            _DrawingPen.StartCap = _DrawingPen.EndCap = LineCap.Round;
            _ArrowPen = _DrawingPen.Clone() as Pen;

            // Create new large arrow cap
            AdjustableArrowCap arrowCap = new AdjustableArrowCap(3, 3, true);
            arrowCap.BaseCap = LineCap.Square;

            _ArrowPen.CustomEndCap = arrowCap;

            _WithArrow = WithArrow;
        }
コード例 #4
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
    /// <summary>
    /// Initializes a new instance of the VGElement class.
    /// </summary>
    /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
    /// <param name="newPen">Pen for edges</param>
    /// <param name="newFont">Font for text</param>
    /// <param name="newFontColor">Color for text</param>
    /// <param name="newBounds">Bounds of element</param>
    /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
    /// <param name="newName">Name of Element</param>
    /// <param name="newElementGroup">Element group description</param>
    public VGElement(
      ShapeDrawAction newShapeDrawAction,
      Pen newPen,
      Font newFont,
      Color newFontColor,
      RectangleF newBounds,
      VGStyleGroup newStyleGroup,
      string newName,
      string newElementGroup)
    {
      this.InitStandards();
      this.styleGroup = newStyleGroup;
      this.name = newName;
      this.elementGroup = newElementGroup;
      this.shapeDrawAction = newShapeDrawAction;
      this.pen = newPen == null ? null : (Pen)newPen.Clone();
      this.Font = newFont == null ? null : (Font)newFont.Clone();
      this.FontColor = newFontColor;

      this.Bounds = newBounds;
    }
コード例 #5
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBounds">Bounds of element</param>
 public VGElement(ShapeDrawAction newShapeDrawAction, Pen newPen, RectangleF newBounds)
 {
   this.InitStandards();
   this.shapeDrawAction = newShapeDrawAction;
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Bounds = newBounds;
 }
コード例 #6
0
        /// <summary>
        /// The constructor for the RenderThread. Sets up the private members
        /// of the class, but DOES NOT start the rendering process.
        /// </summary>
        /// @param metrics The MapMetrics object for this Map
        /// @param features The VectorFeature array
        /// @param type The type of shapefile we're going to draw
        /// @param beginning The array index of the VectorFeature to begin drawing with
        /// @param ending The array index of the VectorFeature to end drawing with
        /// @param pen The pen to draw the features with
        /// @param brush The brush to fill the features with
        public RenderThread( MapMetrics metrics, 
							 VectorFeature[] features,
							 ShapeType type,
							 int beginning,
							 int ending,
							 Pen pen,
							 Brush brush )
        {
            _mapMetrics = metrics;
            _features = features;
            _shapeType = type;
            _beginningFeature = beginning;
            _endingFeature = ending;
            _pen = (Pen) pen.Clone();
            _brush = (Brush) brush.Clone();
            _gr = Graphics.FromImage( _mapMetrics.Canvas );
        }
コード例 #7
0
ファイル: PenTest.cs プロジェクト: nlhepler/mono
		public void Clone ()
		{
			using (Pen p = new Pen (Brushes.Red)) {
				using (Pen clone = (Pen) p.Clone ()) {
					Check (clone);
				}
			}
		}
コード例 #8
0
 private void DrawLineShadowed(Graphics g, Pen pen, float x1, float y1, float x2, float y2, bool flipShadow)
 {
     var shadowPen = (Pen)pen.Clone();
     shadowPen.Color = Settings.ShadowsColor;
     if (!flipShadow)
     {
         g.DrawLine(shadowPen, x1 + 1, y1 + 1, x2 + 1, y2 + 1);
         g.DrawLine(shadowPen, x1 + 1, y1 + 2, x2 + 1, y2 + 2);
         g.DrawLine(shadowPen, x1 + 1, y1 + 3, x2 + 1, y2 + 3);
         g.DrawLine(pen, x1, y1, x2, y2);
     }
     else
     {
         g.DrawLine(shadowPen, x1 + 1, y1 - 1, x2 + 1, y2 - 1);
         g.DrawLine(shadowPen, x1 + 1, y1 - 2, x2 + 1, y2 - 2);
         g.DrawLine(shadowPen, x1 + 1, y1 - 3, x2 + 1, y2 - 3);
         g.DrawLine(pen, x1, y1, x2, y2);
     }
 }
コード例 #9
0
ファイル: Scene2.cs プロジェクト: nexscifix/FiniteVolume
    public void DrawVectorReal(Graphics gdi, Pen pen, int x1, int y1, double vx, double vy, double lenscale)
    {
      Vector3 uv = new Vector3(vx, vy, 0);
      double len = uv.Length();
      uv.Normalize();
      uv = uv * lenscale;
      Pen myPen = (Pen)pen.Clone();
      myPen.Width = (float)(len/4);
      if (myPen.Width > 6)
          myPen.Width = 6;

      DrawLine(gdi, myPen, x1, y1, x1 + (int)(uv.x / 1.8), y1 + (int)(uv.y/ 1.8));
//      DrawLine(gdi, myPen, x1, y1, x1 + (int)(uv.x), y1 + (int)(uv.y ));

      if (Math.Abs(vy) < 0.0000001)
        vy = 0.001;
      {
        double x2 = 1;
        double y2 = -(vx * x2) / vy;
        Vector3 p = new Vector3(x2, y2, 0);
        p.Normalize();
        p = p * (lenscale / 2);
        Vector3 av = uv / 1.8;
        int ax = x1 + (int)av.x;
        int ay = y1 + (int)av.y;
        Vector3 p1 = p / 1.5;
        Vector3 p2 = -p1;
        //        gdi.DrawLine(pen, ax, ay, ax + (int)p1.x, ay + (int)p1.y);
        //        gdi.DrawLine(pen, ax, ay, ax + (int)p2.x, ay + (int)p2.y);
        int sx1 = ax + (int)p1.x;
        int sy1 = ay + (int)p1.y;
        int sx2 = ax + (int)p2.x;
        int sy2 = ay + (int)p2.y;
        //gdi.DrawLine(pen, sx1, sy1, x1 + (int)uv.x, y1 + (int)uv.y);
        //gdi.DrawLine(pen, sx2, sy2, x1 + (int)uv.x, y1 + (int)uv.y);
        //gdi.DrawLine(pen, sx1, sy1, sx2, sy2);

        GraphicsPath path = new GraphicsPath();
        path.AddLines(new Point[] { new Point(startx + sx1, starty - sy1), new Point(startx + sx2, starty - sy2), new Point(startx + x1 + (int)uv.x, starty - (y1 + (int)uv.y)), });
        path.CloseFigure();
//        gdi.DrawPath(Brushes.Red, path);
        gdi.DrawPath(Pens.Red, path);

      }
    }
コード例 #10
0
ファイル: SurfaceForm.cs プロジェクト: YashMaster/GestureSign
        private void InitializePen()
        {
            _drawingPen = new Pen(AppConfig.VisualFeedbackColor, AppConfig.VisualFeedbackWidth * _screenDpi);
            _drawingPen.StartCap = _drawingPen.EndCap = LineCap.Round;
            _drawingPen.LineJoin = LineJoin.Round;

            _shadowPen = new Pen(Color.FromArgb(30, 0, 0, 0), (_drawingPen.Width + 4f)) { EndCap = LineCap.Round, StartCap = LineCap.Round };

            _dirtyMarkerPen = (Pen)_shadowPen.Clone();
            _dirtyMarkerPen.Width *= 1.5f;
        }
コード例 #11
0
        /// <summary>
        /// Рисует линии координатных осей с насечками.
        /// А также внешнюю окантовку графика (с насечками +))
        /// </summary>
        private void DrawCoordinates(Graphics G, Pen Pe, PointF Zero, PointF Left, PointF Right, PointF Up, PointF Down, double kx, double ky)
        {
            G.DrawLine(Pe, Left, Right);    // Рисуем ось X
            G.DrawLine(Pe, Down, Up);       // Рисуем ось Y

            PointF DownLeft = new PointF(Left.X, Down.Y);
            PointF DownRight = new PointF(Right.X, Down.Y);
            PointF UpLeft = new PointF(Left.X, Up.Y);
            PointF UpRight = new PointF(Right.X, Up.Y);

            // --- Рисуем контур

            Pen temp = (Pen)Pe.Clone();
            temp.Color = Color.FromArgb(100, Pe.Color);
            temp.Width = 2;

            G.DrawLine(temp, DownLeft, UpLeft);
            G.DrawLine(temp, UpLeft, UpRight);
            G.DrawLine(temp, UpRight, DownRight);
            G.DrawLine(temp, DownRight, DownLeft);
            
            decimal i;
            
            decimal leftX = (decimal)Left.X;
            decimal rightX = (decimal)Right.X;
            decimal downY = (decimal)Down.Y;
            decimal upY = (decimal)Up.Y;

            // ---- насечки

            for (i = leftX; i <= rightX + 1; i += (decimal)(Step1 * kx))
            {
                G.DrawLine(Pe, new PointF((float)i, Zero.Y - 3), new PointF((float)i, Zero.Y + 3));     // насечка на оси
                G.DrawLine(Pe, new PointF((float)i, DownLeft.Y - 6), new PointF((float)i, DownLeft.Y)); // насечка на границе
            }

            for (i = downY; i >= upY - 1; i -= (decimal)(Step2 * ky))
            {
                G.DrawLine(Pe, new PointF(Zero.X - 3, (float)i), new PointF(Zero.X + 3, (float)i));
                G.DrawLine(Pe, new PointF(DownLeft.X, (float)i), new PointF(DownLeft.X + 6, (float)i)); // насечка на границе
            }
        }
コード例 #12
0
ファイル: PictureBoxExtended.cs プロジェクト: mgrman/DGCLib
        private void DrawCanvas(Graphics g, SizeF windowSize, float scale)
        {
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.SmoothingMode = SmoothingMode.HighQuality;

            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            windowSize = ClipSize(windowSize);

            var mat = new Matrix();
            //mat.Scale(0.5f, 0.5f);
            mat.Translate(windowSize.Width, windowSize.Height);
            g.Transform = mat;
            _canvasMatrix = mat.Clone();
            _canvasMatrix.Invert();

            _drawRectangle = new RectangleF(-(float)windowSize.Width, -(float)windowSize.Height, (float)windowSize.Width * 2, (float)windowSize.Height * 2);
            g.DrawRectangle(Pens.Black, _drawRectangle.X, _drawRectangle.Y, _drawRectangle.Width, _drawRectangle.Height);

            if (_geometry == null) return;

            foreach (var geo in _geometry)
            {
                try
                {
                    foreach (var point in geo.PointsToDraw)
                    {
                        var pos = point.ToPointF();

                        Brush brush = new SolidBrush(geo.Color.ToColor());
                        PointF posWindow = pos.Scale(windowSize);

                        var size = (float)geo.Size * scale;

                        g.FillEllipse(brush, (posWindow.X - size / 2), (posWindow.Y - size / 2), size, size);
                    }

                    foreach (var spline in geo.LinesToDraw)
                    {
                        var size = (float)geo.Size * scale;
                        Pen pen = new Pen(geo.Color.ToColor(), (float)size / 2);
                        Pen penDashed = pen.Clone() as Pen;
                        penDashed.DashPattern = new float[] { 0.5f, 0.5f };
                        penDashed.DashStyle = DashStyle.Dash;

                        Brush brush = new SolidBrush(geo.Color.ToColor());

                        g.DrawBezier(pen,
                            spline.PosA.ToPointF().Scale(windowSize),
                            spline.PosB.ToPointF().Scale(windowSize),
                            spline.PosC.ToPointF().Scale(windowSize),
                            spline.PosD.ToPointF().Scale(windowSize));
                    }

                    foreach (var text in geo.TextToDraw)
                    {
                        var size = (float)geo.Size * scale;

                        Brush brush = Brushes.Black;
                        Font font = new Font(FontFamily.GenericMonospace, (float)size);
                        var posWindow = (text.Position.ToPointF().Scale(windowSize));
                        g.DrawString(text.Text, font, brush, posWindow);
                    }

                    //var renderer = RendererStorage.GetRenderer(geo);
                    //if (renderer == null)
                    //    continue;
                    //renderer.Draw(geo,g, windowSize, scale);
                }
                catch (Exception ex)
                {
                    InterAppComunication.ReportError("Problem drawing " + geo.ToString(), ex);
                }
            }
        }
コード例 #13
0
        private void InitDefaultProperties()
        {
            //defaults
            ShowCommandName = true;
            ShowPath = true;
            ViewFadeOut = true;

            _pathMaxPointCount = (int)(256 * _dpiFactor);

            const float widthBase = 2f;

            #region init pens
            _mainPen = new Pen(Color.FromArgb(255, 50, 200, 100), widthBase * _dpiFactor) { EndCap = LineCap.Round, StartCap = LineCap.Round };
            _middleBtnPen = new Pen(Color.FromArgb(255, 20, 150, 200), widthBase * _dpiFactor) { EndCap = LineCap.Round, StartCap = LineCap.Round };
            _borderPen = new Pen(Color.FromArgb(220, 255, 255, 255), (widthBase + 2.5f) * _dpiFactor) { EndCap = LineCap.Round, StartCap = LineCap.Round };
            _alternativePen = new Pen(Color.FromArgb(255, 255, 120, 20), widthBase * _dpiFactor) { EndCap = LineCap.Round, StartCap = LineCap.Round };
            _shadowPen = new Pen(Color.FromArgb(30, 0, 0, 0), (widthBase + 4f) * _dpiFactor) { EndCap = LineCap.Round, StartCap = LineCap.Round };
            _shadowPenWidth = _shadowPen.Width;
            _dirtyMarkerPen = (Pen) _shadowPen.Clone();
            _dirtyMarkerPen.Width *= 1.5f;

            #endregion
        }
コード例 #14
0
	// Select a pen into the toolkit graphics object.
	private void SelectPen(Pen pen)
			{
				if(pen == null)
				{
					throw new ArgumentNullException("pen");
				}
				if(graphics == null)
				{
					throw new ObjectDisposedException("graphics");
				}
				
				Pen penNew = pen;
				if( transform != null ) {
					// calculation new pen size, if a transformation is set
					// using the workaround for Font scaling
					float penWidth = pen.Width;
					float newWidth = transform.TransformFontSize(penWidth);
					if( penWidth != newWidth ) {
						penNew = (Pen) pen.Clone();
						penNew.Width = newWidth;
					}
				}
				
				IToolkitPen tpen = penNew.GetPen(graphics.Toolkit);
				if(penNew.PenType == PenType.SolidColor)
				{
					tpen.Select(graphics);
				}
				else
				{
					IToolkitBrush tbrush = penNew.Brush.GetBrush(graphics.Toolkit);
					tpen.Select(graphics, tbrush);
				}
			}
コード例 #15
0
ファイル: PieSlice.cs プロジェクト: RapidFiring/evemon
 /// <summary>
 ///   Initializes a new instance of <c>PieSlice</c> class with given 
 ///   bounds and visual style.
 /// </summary>
 /// <param name="boundingRectX">
 ///   x-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectY">
 ///   y-coordinate of the upper-left corner of the rectangle that is 
 ///   used to draw the top surface of the pie slice.
 /// </param>
 /// <param name="boundingRectWidth">
 ///   Width of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="boundingRectHeight">
 ///   Height of the rectangle that is used to draw the top surface of 
 ///   the pie slice.
 /// </param>
 /// <param name="sliceHeight">
 ///   Height of the pie slice.
 /// </param>
 /// <param name="startAngle">
 ///   Starting angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="sweepAngle">
 ///   Sweep angle (in degrees) of the pie slice.
 /// </param>
 /// <param name="surfaceColor">
 ///   Color used to paint the pie slice.
 /// </param>
 /// <param name="shadowStyle">
 ///   Shadow style used for slice rendering.
 /// </param>
 /// <param name="edgeColorType">
 ///   Edge color style used for slice rendering.
 /// </param>
 public PieSlice(float boundingRectX, float boundingRectY, float boundingRectWidth, float boundingRectHeight,
     float sliceHeight, float startAngle, float sweepAngle, Color surfaceColor, ShadowStyle shadowStyle,
     EdgeColorType edgeColorType)
     : this()
 {
     // set some persistent values
     m_actualStartAngle = startAngle;
     m_actualSweepAngle = sweepAngle;
     m_surfaceColor = surfaceColor;
     m_shadowStyle = shadowStyle;
     m_edgeColorType = edgeColorType;
     // create pens for rendering
     Color edgeLineColor = EdgeColor.GetRenderingColor(edgeColorType, surfaceColor);
     using (Pen pen = new Pen(edgeLineColor))
     {
         pen.LineJoin = LineJoin.Round;
         m_pen = (Pen)pen.Clone();
     }
     InitializePieSlice(boundingRectX, boundingRectY, boundingRectWidth, boundingRectHeight, sliceHeight);
 }
コード例 #16
0
ファイル: Map.cs プロジェクト: SDRC-India/sdrcdevinfo
        private void DrawColorTheme(ref Graphics g, Theme _Theme, Matrix mTransMatrix, RectangleF CurExt)
        {
            Legend _Legend;
            Shape _Shape;
            //Polygon : Polyline : Point
            int i;
            int j;
            GraphicsPath gpShp = new GraphicsPath();
            GraphicsPath gpSelShp = new GraphicsPath();
            StringFormat _StringFormat = new StringFormat();
            _StringFormat.Alignment = StringAlignment.Center;
            _StringFormat.LineAlignment = StringAlignment.Center;
            _StringFormat.FormatFlags = StringFormatFlags.NoClip;

            bool BaseLyrVisibility = false;
            //*** Set an array of brush based on current theme legend items
            Brush[] BrLegend = new Brush[_Theme.Legends.Count];
            for (i = 0; i <= _Theme.Legends.Count - 1; i++)
            {
                _Legend = _Theme.Legends[i];
                if (_Legend.FillStyle == FillStyle.Solid)
                {
                    BrLegend[i] = new SolidBrush(_Legend.Color);
                }
                else if (_Legend.FillStyle == FillStyle.Transparent)
                {
                    BrLegend[i] = new SolidBrush(Color.Transparent);
                }
                else
                {
                    BrLegend[i] = new HatchBrush((HatchStyle)_Legend.FillStyle, _Legend.Color, Color.Transparent);
                }
            }

            Pen PnTheme = new Pen(_Theme.BorderColor, _Theme.BorderWidth);
            Pen BorderHighlight = new Pen(_Theme.BorderColor, _Theme.BorderWidth + 0.7F);
            BorderHighlight.Alignment = PenAlignment.Inset;
            BorderHighlight.DashStyle = _Theme.BorderStyle;

            if (_Theme.BorderWidth == 0)
                PnTheme.Color = Color.Transparent;
            //??? Strange that setting Pen width = 0 gives effect of Pen width 1. So this workaround
            PnTheme.DashStyle = _Theme.BorderStyle;

            HatchBrush BrSelection = new HatchBrush(HatchStyle.Percent40, m_SelectionColor, Color.Transparent);
            Pen PnSelection = new Pen(m_SelectionColor);

            //*** If lyr exists in theme.Layervisibility collection
            foreach (Layer Lyr in Layers)
            {
                //Traverse Layers collection
                {
                    if (Lyr.Extent.IntersectsWith(CurExt) || CurExt.Contains(Lyr.Extent) || Lyr.Extent.Contains(CurExt))
                    {
                        // Render layer only if it lies within current map extent
                        if (_Theme.Type == ThemeType.Color)
                        {
                            if (_Theme.LayerVisibility[Lyr.ID] == null)
                                BaseLyrVisibility = false;
                            else
                                BaseLyrVisibility = (bool)_Theme.LayerVisibility[Lyr.ID];
                        }
                        else if (_Theme.Type == ThemeType.Hatch)
                        {
                            BaseLyrVisibility = Lyr.Visible;
                        }

                        Hashtable ht = Lyr.GetRecords(Lyr.LayerPath + "\\" + Lyr.ID);
                        IDictionaryEnumerator dicEnumerator = ht.GetEnumerator();
                        if (Lyr.LayerType == ShapeType.Polygon & BaseLyrVisibility == true)
                        {
                            while (dicEnumerator.MoveNext())
                            {
                                //Traverse Shapes
                                _Shape = (Shape)dicEnumerator.Value;
                                if (_Shape.Extent.IntersectsWith(CurExt))
                                {
                                    //Render shape only if it lies within current map extent
                                    gpShp.Reset();
                                    for (j = 0; j <= _Shape.Parts.Count - 1; j++)
                                    {
                                        gpShp.AddPolygon((PointF[])_Shape.Parts[j]);
                                    }
                                    gpShp.Transform(mTransMatrix);
                                    if (_Theme.AreaIndexes.ContainsKey(_Shape.AreaId))
                                    {
                                        if (_Theme.MultiLegend == true)
                                        {
                                            {
                                                switch (_Theme.MultiLegendCriteria)
                                                {
                                                    case "SRC":
                                                        if (_Theme.MultiLegendCol.ContainsKey(((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Source))
                                                        {
                                                            //TODO Optimize SolidBrush
                                                            g.FillPath(new SolidBrush(((Legends)_Theme.MultiLegendCol[((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Source])[(int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo].Color), gpShp);
                                                        }

                                                        break;
                                                    case "SGP":
                                                        if (_Theme.MultiLegendCol.ContainsKey(((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Subgroup))
                                                        {
                                                            g.FillPath(new SolidBrush(((Legends)_Theme.MultiLegendCol[((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).Subgroup])[(int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo].Color), gpShp);
                                                        }

                                                        break;
                                                    default:
                                                        if (_Theme.MultiLegendCol.ContainsKey(((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).MDFldVal[_Theme.MultiLegendCriteria]))
                                                        {
                                                            g.FillPath(new SolidBrush(((Legends)_Theme.MultiLegendCol[((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).MDFldVal[_Theme.MultiLegendCriteria]])[(int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo].Color), gpShp);
                                                        }

                                                        break;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            g.FillPath(BrLegend[(int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo], gpShp);
                                        }
                                    }

                                    else
                                    {
                                        g.FillPath(BrLegend[BrLegend.Length - 1], gpShp);
                                    }
                                    try
                                    {
                                        //- Draw Specified Area's polygon to hightlight with different border
                                        if (_Shape.AreaId == this.AreaIDToHighlight)
                                        {
                                            g.DrawPath(BorderHighlight, gpShp);
                                        }
                                        else
                                        {
                                            //- Draw Area polygon Path
                                            g.DrawPath(PnTheme, gpShp);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        //Console.Write(ex.Message) '??? AFRERI Eritria problem
                                    }

                                    //*** Draw Base layer selection
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                        g.FillPath(BrSelection, gpShp);

                                    //-Exist Drawing Function
                                    if (_Shape.AreaId == this.AreaIDToHighlight)
                                    {
                                        break;
                                    }
                                }
                            }
                            //Traverse Shapes
                        }
                        else if (((Lyr.LayerType == ShapeType.PolygonFeature & BaseLyrVisibility == true) | ((Lyr.LayerType == ShapeType.PolygonCustom | Lyr.LayerType == ShapeType.PolygonBuffer) & Lyr.Visible == true)) & _Theme.Type == ThemeType.Color)
                        {
                            Pen PnLayer = new Pen(Lyr.BorderColor, Lyr.BorderSize);
                            if (Lyr.BorderSize == 0)
                                PnLayer.Color = Color.Transparent;
                            //??? Strange that setting Pen width = 0 gives effect of Pen width 1. So this workaround
                            PnLayer.DashStyle = Lyr.BorderStyle;
                            Brush BrLayer;
                            if (Lyr.FillStyle == FillStyle.Solid)
                            {
                                BrLayer = new SolidBrush(Lyr.FillColor);
                            }
                            else if (Lyr.FillStyle == FillStyle.Transparent)
                            {
                                BrLayer = new SolidBrush(Color.Transparent);
                            }
                            else
                            {
                                BrLayer = new HatchBrush((HatchStyle)Lyr.FillStyle, Lyr.FillColor, Color.Transparent);
                            }
                            gpShp.Reset();
                            gpShp.FillMode = FillMode.Winding;
                            gpSelShp.Reset();
                            gpSelShp.FillMode = FillMode.Winding;
                            while (dicEnumerator.MoveNext())
                            {
                                _Shape = (Shape)dicEnumerator.Value;
                                if (_Shape.Extent.IntersectsWith(CurExt))
                                {
                                    for (j = 0; j <= _Shape.Parts.Count - 1; j++)
                                    {
                                        try
                                        {
                                            gpShp.AddPolygon((PointF[])_Shape.Parts[j]);
                                        }
                                        catch (Exception ex)
                                        {

                                        }
                                        if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                            gpSelShp.AddPolygon((PointF[])_Shape.Parts[j]);
                                    }
                                }
                            }
                            gpShp.Transform(mTransMatrix);
                            g.FillPath(BrLayer, gpShp);
                            try
                            {
                                g.DrawPath(PnLayer, gpShp);
                            }
                            catch (Exception ex)
                            {
                                Console.Write(ex.Message);
                                //??? AFRERI Eritria problem
                            }
                            if (Lyr.SelectedArea.Count > 0)
                            {
                                gpSelShp.Transform(mTransMatrix);
                                g.FillPath(BrSelection, gpSelShp);
                            }
                            BrLayer.Dispose();
                            PnLayer.Dispose();
                        }
                        else if (Lyr.LayerType == ShapeType.PolyLine & BaseLyrVisibility == true & _Theme.Type == ThemeType.Color)
                        {
                            Pen PnLegend = new Pen(Lyr.BorderColor, Lyr.BorderSize);
                            PnLegend.DashStyle = Lyr.BorderStyle;
                            while (dicEnumerator.MoveNext())
                            {
                                //*** Traverse Shapes
                                _Shape = (Shape)dicEnumerator.Value;
                                gpShp.Reset();
                                for (j = 0; j <= _Shape.Parts.Count - 1; j++)
                                {
                                    gpShp.StartFigure();
                                    gpShp.AddLines((PointF[])_Shape.Parts[j]);
                                }
                                gpShp.Transform(mTransMatrix);
                                PnLegend.Color = _Theme.Legends[(int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo].Color;
                                g.DrawPath(PnLegend, gpShp);
                            }
                            PnLegend.Dispose();
                        }
                        else if (((Lyr.LayerType == ShapeType.PolyLineFeature & BaseLyrVisibility == true) | (Lyr.LayerType == ShapeType.PolyLineCustom & Lyr.Visible == true)) & _Theme.Type == ThemeType.Color)
                        {
                            gpShp.Reset();
                            while (dicEnumerator.MoveNext())
                            {
                                //*** Traverse Shapes
                                _Shape = (Shape)dicEnumerator.Value;
                                for (j = 0; j <= _Shape.Parts.Count - 1; j++)
                                {
                                    gpShp.StartFigure();
                                    gpShp.AddLines((PointF[])_Shape.Parts[j]);
                                }
                            }
                            Pen PnLayer = new Pen(Lyr.BorderColor, Lyr.BorderSize);
                            PnLayer.DashStyle = Lyr.BorderStyle;
                            gpShp.Transform(mTransMatrix);
                            g.DrawPath(PnLayer, gpShp);
                            PnLayer.Dispose();
                        }
                        else if (Lyr.LayerType == ShapeType.Point & BaseLyrVisibility == true)
                        {
                            g.SmoothingMode = SmoothingMode.AntiAlias;
                            {
                                PointF[] Pt = new PointF[1];
                                int LegendItemIndex;
                                int[] MarkerSize = new int[_Theme.Legends.Count];
                                //PtSize based on Legend item
                                char[] MarkerChar = new char[_Theme.Legends.Count];
                                Font[] MarkerFont = new Font[_Theme.Legends.Count];
                                Pen PnCross = (Pen)PnTheme.Clone();
                                for (i = 0; i <= _Theme.Legends.Count - 1; i++)
                                {
                                    _Legend = _Theme.Legends[i];
                                    MarkerSize[i] = _Legend.MarkerSize;
                                    MarkerChar[i] = _Legend.MarkerChar;
                                    MarkerFont[i] = _Legend.MarkerFont;
                                    if (_Legend.MarkerType == MarkerStyle.Cross)
                                        PnCross.Color = _Legend.Color;
                                }
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    //*** BugFix 04 July 2006 Base point layer missing data rendered with 1st legend information
                                    if (_Theme.AreaIndexes.ContainsKey(_Shape.AreaId))
                                    {
                                        LegendItemIndex = (int)((AreaInfo)_Theme.AreaIndexes[_Shape.AreaId]).RenderingInfo;
                                    }
                                    else
                                    {
                                        LegendItemIndex = _Theme.Legends.Count - 1;
                                    }
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    switch (_Theme.Legends[LegendItemIndex].MarkerType)
                                    {
                                        case MarkerStyle.Circle:
                                            g.FillEllipse(BrLegend[LegendItemIndex], (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);
                                            g.DrawEllipse(PnTheme, (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);
                                            if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                                g.FillEllipse(BrSelection, (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);

                                            break;
                                        case MarkerStyle.Square:
                                            g.FillRectangle(BrLegend[LegendItemIndex], (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);
                                            g.DrawRectangle(PnTheme, (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);
                                            if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                                g.FillRectangle(BrSelection, (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2, MarkerSize[LegendItemIndex], MarkerSize[LegendItemIndex]);

                                            break;
                                        case MarkerStyle.Triangle:
                                            //*** 1.Equilateral triangle with altitude = MarkerSize(LegendItemIndex) 2.Equilateral triangle with sides = MarkerSize(LegendItemIndex)
                                            PointF[] Vertex = new PointF[3];
                                            int PtSize;
                                            PtSize = (int)(Math.Sqrt(3) / 4 * MarkerSize[LegendItemIndex]);
                                            Vertex[0] = new PointF(Pt[0].X - PtSize, Pt[0].Y + PtSize);
                                            //altitude = PtSize 'Vertex(0) = New PointF(pt(0).X - PtSize / 2, pt(0).Y + PtSize / 2) 'side = PtSize
                                            Vertex[1] = new PointF(Pt[0].X + PtSize, Pt[0].Y + PtSize);
                                            //altitude = PtSize 'Vertex(1) = New PointF(pt(0).X + PtSize / 2, pt(0).Y + PtSize / 2) 'side = PtSize
                                            Vertex[2] = new PointF(Pt[0].X, Pt[0].Y - PtSize);
                                            g.FillPolygon(BrLegend[LegendItemIndex], Vertex);
                                            g.DrawPolygon(PnTheme, Vertex);
                                            if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                                g.FillPolygon(BrSelection, Vertex);

                                            Vertex = null;
                                            break;
                                        case MarkerStyle.Cross:
                                            g.DrawLine(PnCross, (int)Pt[0].X - MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y, (int)Pt[0].X + MarkerSize[LegendItemIndex] / 2, (int)Pt[0].Y);
                                            g.DrawLine(PnCross, (int)Pt[0].X, (int)Pt[0].Y + MarkerSize[LegendItemIndex] / 2, (int)Pt[0].X, (int)Pt[0].Y - MarkerSize[LegendItemIndex] / 2);
                                            break;
                                        case MarkerStyle.Custom:
                                            g.DrawString(MarkerChar[LegendItemIndex].ToString(), MarkerFont[LegendItemIndex], BrLegend[LegendItemIndex], Pt[0].X, Pt[0].Y, _StringFormat);
                                            break;
                                    }
                                }
                                for (i = 0; i <= MarkerFont.Length - 1; i++)
                                {
                                    MarkerFont[i].Dispose();
                                }
                                Pt = null;
                                PnCross.Dispose();
                            }
                            g.SmoothingMode = SmoothingMode.None;
                        }
                        else if (((Lyr.LayerType == ShapeType.PointFeature & BaseLyrVisibility == true) | (Lyr.LayerType == ShapeType.PointCustom & Lyr.Visible == true)) & _Theme.Type == ThemeType.Color)
                        {
                            g.SmoothingMode = SmoothingMode.AntiAlias;
                            Pen PnLayer = new Pen(Lyr.FillColor, 0.01F);
                            Brush BrLayer = new SolidBrush(Lyr.FillColor);
                            PointF[] Pt = new PointF[1];
                            int PtSize = Lyr.MarkerSize;
                            // CInt((_Layer.MarkerSize * m_FullExtent.Width) / (8 * m_CurrentExtent.Width))
                            gpShp.Reset();
                            gpSelShp.Reset();
                            if (Lyr.MarkerStyle == MarkerStyle.Circle)
                            {
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                    {
                                        gpSelShp.AddEllipse((int)Pt[0].X - PtSize / 2, (int)Pt[0].Y - PtSize / 2, PtSize, PtSize);
                                    }
                                    else
                                    {
                                        gpShp.AddEllipse((int)Pt[0].X - PtSize / 2, (int)Pt[0].Y - PtSize / 2, PtSize, PtSize);
                                    }
                                }
                            }
                            else if (Lyr.MarkerStyle == MarkerStyle.Square)
                            {
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                    {
                                        gpSelShp.AddRectangle(new RectangleF(Pt[0].X - PtSize / 2, Pt[0].Y - PtSize / 2, PtSize, PtSize));
                                    }
                                    else
                                    {
                                        gpShp.AddRectangle(new RectangleF(Pt[0].X - PtSize / 2, Pt[0].Y - PtSize / 2, PtSize, PtSize));
                                    }
                                }
                            }
                            else if (Lyr.MarkerStyle == MarkerStyle.Triangle)
                            {
                                //*** 1.Equilateral triangle with altitude = PtSize 2.Equilateral triangle with sides = PtSize
                                PointF[] Vertex = new PointF[3];
                                PtSize = (int)(Math.Sqrt(3) / 4 * PtSize);
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    Vertex[0] = new PointF(Pt[0].X - PtSize, Pt[0].Y + PtSize);
                                    //altitude = PtSize 'Vertex(0) = New PointF(pt(0).X - PtSize / 2, pt(0).Y + PtSize / 2) 'side = PtSize
                                    Vertex[1] = new PointF(Pt[0].X + PtSize, Pt[0].Y + PtSize);
                                    //altitude = PtSize 'Vertex(1) = New PointF(pt(0).X + PtSize / 2, pt(0).Y + PtSize / 2) 'side = PtSize
                                    Vertex[2] = new PointF(Pt[0].X, Pt[0].Y - PtSize);
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                    {
                                        gpSelShp.AddPolygon(Vertex);
                                    }
                                    else
                                    {
                                        gpShp.AddPolygon(Vertex);
                                    }
                                }
                                Vertex = null;
                            }
                            else if (Lyr.MarkerStyle == MarkerStyle.Cross)
                            {
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                    {
                                        gpSelShp.AddLine(new PointF(Pt[0].X - PtSize / 2, Pt[0].Y), new PointF(Pt[0].X + PtSize / 2, Pt[0].Y));
                                        gpSelShp.CloseFigure();
                                        gpSelShp.AddLine(new PointF(Pt[0].X, Pt[0].Y + PtSize / 2), new PointF(Pt[0].X, Pt[0].Y - PtSize / 2));
                                        gpSelShp.CloseFigure();
                                    }
                                    else
                                    {
                                        gpShp.AddLine(new PointF(Pt[0].X - PtSize / 2, Pt[0].Y), new PointF(Pt[0].X + PtSize / 2, Pt[0].Y));
                                        gpShp.CloseFigure();
                                        gpShp.AddLine(new PointF(Pt[0].X, Pt[0].Y + PtSize / 2), new PointF(Pt[0].X, Pt[0].Y - PtSize / 2));
                                        gpShp.CloseFigure();
                                    }
                                }
                            }
                            else if (Lyr.MarkerStyle == MarkerStyle.Custom)
                            {
                                Font _MFnt = new Font(Lyr.MarkerFont.FontFamily, PtSize);
                                while (dicEnumerator.MoveNext())
                                {
                                    //*** Traverse Shapes
                                    _Shape = (Shape)dicEnumerator.Value;
                                    Pt[0] = (PointF)_Shape.Parts[0];
                                    mTransMatrix.TransformPoints(Pt);
                                    if (Lyr.SelectedArea.Contains(_Shape.AreaId))
                                    {
                                        g.DrawString(Lyr.MarkerChar.ToString(), _MFnt, BrSelection, Pt[0].X, Pt[0].Y, _StringFormat);
                                    }
                                    else
                                    {
                                        g.DrawString(Lyr.MarkerChar.ToString(), _MFnt, BrLayer, Pt[0].X, Pt[0].Y, _StringFormat);
                                    }
                                }
                                _MFnt.Dispose();
                            }
                            g.FillPath(BrLayer, gpShp);
                            g.DrawPath(PnLayer, gpShp);
                            g.FillPath(BrSelection, gpSelShp);
                            g.DrawPath(PnSelection, gpSelShp);
                            Pt = null;
                            PnLayer.Dispose();
                            BrLayer.Dispose();
                            g.SmoothingMode = SmoothingMode.None;
                        }
                        ht = null;
                    }
                }
                //Lyr = null;
            }
            //Traverse Layers collection

            _Shape = null;
            for (i = 0; i <= BrLegend.Length - 1; i++)
            {
                BrLegend[i].Dispose();
            }
            PnTheme.Dispose();
            BorderHighlight.Dispose();
            BrSelection.Dispose();
            PnSelection.Dispose();
            _StringFormat.Dispose();
            gpSelShp.Dispose();
            gpShp.Dispose();
        }
コード例 #17
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Pen newPen,
   Brush newBrush,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Bounds = newBounds;
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
 }
コード例 #18
0
ファイル: PolygonObject.cs プロジェクト: easai/Logger
 public void setPen(Pen pen)
 {
     this.pen = (Pen)pen.Clone();
 }
コード例 #19
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBrush">Brush for text and fills</param>
 /// <param name="newFont">Font for text</param>
 /// <param name="newFontColor">Color for text</param>
 /// <param name="newBounds">Bounds of element</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 /// <param name="newSound">The <see cref="AudioFile"/> to play with this element.</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Pen newPen,
   Brush newBrush,
   Font newFont,
   Color newFontColor,
   RectangleF newBounds,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup,
   AudioFile newSound)
 {
   this.InitStandards();
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
   this.Bounds = newBounds;
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.Font = newFont == null ? null : (Font)newFont.Clone();
   this.FontColor = newFontColor;
   this.shapeDrawAction = newShapeDrawAction;
   if (newSound != null)
   {
     this.Sound = (AudioFile)newSound.Clone();
   }
 }
コード例 #20
0
 /// <summary>
 /// Draw a selectionborder around the freehand path
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="linePen"></param>
 protected void DrawSelectionBorder(Graphics graphics, Pen linePen)
 {
     using (Pen selectionPen = (Pen) linePen.Clone()) {
         using (GraphicsPath selectionPath = (GraphicsPath) freehandPath.Clone()) {
             selectionPen.Width += 5;
             selectionPen.Color = Color.FromArgb(120, Color.LightSeaGreen);
             graphics.DrawPath(selectionPen, selectionPath);
             selectionPath.Widen(selectionPen);
             selectionPen.DashPattern = new float[]{2,2};
             selectionPen.Color = Color.LightSeaGreen;
             selectionPen.Width = 1;
             graphics.DrawPath(selectionPen, selectionPath);
         }
     }
 }
コード例 #21
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newBrush">Brush for fills</param>
 public VGElement(ShapeDrawAction newShapeDrawAction, Pen newPen, Brush newBrush)
 {
   this.InitStandards();
   this.shapeDrawAction = newShapeDrawAction;
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
   this.Brush = newBrush == null ? null : (Brush)newBrush.Clone();
 }
コード例 #22
0
ファイル: PenTest.cs プロジェクト: nlhepler/mono
		public void Brush_Dispose ()
		{
			using (Pen p = new Pen (Brushes.Red, 2.5f)) {
				// are we getting the original brush ?
				Brush b1 = p.Brush;
				b1.Dispose ();
				Check (p);
				using (Pen clone = (Pen) p.Clone ()) {
					Check (clone);
				}
				Assert.IsFalse (Object.ReferenceEquals (b1, p.Brush), "Brush");
				// nope :)
			}
		}
コード例 #23
0
ファイル: VGElement.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// Initializes a new instance of the VGElement class.
 /// </summary>
 /// <param name="newShapeDrawAction">Drawing action: Edge, Fill, Both</param>
 /// <param name="newPen">Pen for edges</param>
 /// <param name="newStyleGroup">Group Enumeration, <see cref="VGStyleGroup"/></param>
 /// <param name="newName">Name of Element</param>
 /// <param name="newElementGroup">Element group description</param>
 public VGElement(
   ShapeDrawAction newShapeDrawAction,
   Pen newPen,
   VGStyleGroup newStyleGroup,
   string newName,
   string newElementGroup)
 {
   this.InitStandards();
   this.styleGroup = newStyleGroup;
   this.name = newName;
   this.elementGroup = newElementGroup;
   this.shapeDrawAction = newShapeDrawAction;
   this.pen = newPen == null ? null : (Pen)newPen.Clone();
 }
コード例 #24
0
 /// <summary>
 /// Create CanvasRenderingContext. Graphics and Bitmap passed into constructor should be related to each other
 /// </summary>
 /// <param name="s">Graphics object to get resolution and size data from</param>
 /// <param name="stroke">initial Pen configuration</param>
 /// <param name="fill">initial Brush configuration</param>
 /// <param name="visible">determing is this object be visible inside container</param>
 public CanvasRenderingContext2D(Graphics s, Bitmap bitmap, Pen stroke, IFill fill, bool visible)
 {
     var width = (int) s.VisibleClipBounds.Width;
     var height = (int) s.VisibleClipBounds.Height;
     _visible = visible;
     SetLineConfig(stroke);
     surface = s;
     _surfaceBitmap = bitmap;
     _stroke = stroke;
     _fill = fill;
     SetDefaultValues();
     //TODO: investigate how can we get all data from fill and stroke to CanvasRenderingContext2D properties
     //or just avoid such parameters in constructor
     strokeStyle = "rgba(" + stroke.Color.R + "," + stroke.Color.G + "," + stroke.Color.B + "," + stroke.Color.A +
                   ")";
     fillStyle = "rgba(" + fill.color.R + "," + fill.color.G + "," + fill.color.B + "," + fill.color.A + ")";
     _initialConfig = new CanvasConfig(stroke.Clone() as Pen, fill.Clone() as Fill);
     OnPartialDraw += CanvasRenderingContext2D_OnPartialDraw;
 }
コード例 #25
0
ファイル: TestSystemPens.cs プロジェクト: nlhepler/mono
		void CheckMethods (Pen pen, String tag)
		{
			// Try modifying a SystemPen by calling methods.
			// ArgumentException must be thrown in some cases.
/*
			try {
				// NotImplemented
				pen.SetLineCap (LineCap.Flat, LineCap.Round, DashCap.Triangle);
				Assert.Fail (tag + "#1: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (tag + "#1", true);
			}
*/
			pen.ResetTransform ();
			pen.RotateTransform (90);
			pen.ScaleTransform (2, 1);
			pen.TranslateTransform (10, 20);
			pen.MultiplyTransform (new Matrix ());
			pen.Clone ();

			try {
				pen.Dispose ();
				Assert.Fail (tag + "#8: must throw ArgumentException");
			} catch (ArgumentException) {
				Assert.IsTrue (true, tag + "#8");
			}
		}