protected override void OnPaint(PaintEventArgs e)
 {
     var iRegion = new Region(e.ClipRectangle);
     e.Graphics.FillRegion(new SolidBrush(BackColor), iRegion);
     if (Items.Count > 0)
     {
         for (int i = 0; i < Items.Count; ++i)
         {
             Rectangle irect = GetItemRectangle(i);
             if (e.ClipRectangle.IntersectsWith(irect))
             {
                 if ((SelectionMode == SelectionMode.One && SelectedIndex == i)
                             || (SelectionMode == SelectionMode.MultiSimple && SelectedIndices.Contains(i))
                             || (SelectionMode == SelectionMode.MultiExtended && SelectedIndices.Contains(i)))
                 {
                     OnDrawItem(new DrawItemEventArgs(e.Graphics, Font,
                         irect, i,
                         DrawItemState.Selected, ForeColor,
                         BackColor));
                 }
                 else
                 {
                     OnDrawItem(new DrawItemEventArgs(e.Graphics, Font,
                         irect, i,
                         DrawItemState.Default, ForeColor,
                         BackColor));
                 }
                 iRegion.Complement(irect);
             }
         }
     }
     base.OnPaint(e);
 }
 protected override void OnPaint(PaintEventArgs e)
 {
     Region iRegion = new Region(e.ClipRectangle);
     e.Graphics.FillRegion(new SolidBrush(this.BackColor), iRegion);
     if (this.Items.Count > 0)
     {
         Debug.WriteLine("Hello");
         for (int i = 0; i < this.Items.Count; ++i)
         {
             System.Drawing.Rectangle irect = this.GetItemRectangle(i);
             if (e.ClipRectangle.IntersectsWith(irect))
             {
                 if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i)
                 || (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i))
                 || (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i)))
                 {
                     OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font,
                         irect, i, DrawItemState.Selected, this.ForeColor,
                         this.BackColor));
                 }
                 else
                 {
                     OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font,
                         irect, i, DrawItemState.Default, this.ForeColor,
                         this.BackColor));
                 }
                 iRegion.Complement(irect);
             }
         }
     }
     base.OnPaint(e);
 }
 protected override void OnPaint(PaintEventArgs e)
 {
     Region region = new Region(e.ClipRectangle);
     e.Graphics.FillRegion(this.backBrush, region);
     if (base.Items.Count > 0)
     {
         for (int i = 0; i < base.Items.Count; i++)
         {
             Rectangle itemRectangle = base.GetItemRectangle(i);
             if (e.ClipRectangle.IntersectsWith(itemRectangle))
             {
                 if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i) || (this.SelectionMode == SelectionMode.MultiSimple && base.SelectedIndices.Contains(i)) || (this.SelectionMode == SelectionMode.MultiExtended && base.SelectedIndices.Contains(i)))
                 {
                     this.OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font, itemRectangle, i, DrawItemState.Selected, this.ForeColor, this.BackColor));
                 }
                 else
                 {
                     this.OnDrawItem(new DrawItemEventArgs(e.Graphics, this.Font, itemRectangle, i, DrawItemState.Default, this.ForeColor, this.BackColor));
                 }
                 region.Complement(itemRectangle);
             }
         }
     }
     base.OnPaint(e);
 }
 protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
 {
     System.Drawing.Region iRegion = new System.Drawing.Region(e.ClipRectangle);
     e.Graphics.FillRegion(new System.Drawing.SolidBrush(this.BackColor), iRegion);
     if (this.Items.Count > 0)
     {
         for (int i = 0; i < this.Items.Count; ++i)
         {
             System.Drawing.Rectangle irect = this.GetItemRectangle(i);
             if (e.ClipRectangle.IntersectsWith(irect))
             {
                 if ((this.SelectionMode == System.Windows.Forms.SelectionMode.One && this.SelectedIndex == i) ||
                     (this.SelectionMode == System.Windows.Forms.SelectionMode.MultiSimple && this.SelectedIndices.Contains(i)) ||
                     (this.SelectionMode == System.Windows.Forms.SelectionMode.MultiExtended && this.SelectedIndices.Contains(i)))
                 {
                     OnDrawItem(new System.Windows.Forms.DrawItemEventArgs(e.Graphics, this.Font,
                                                                           irect, i,
                                                                           System.Windows.Forms.DrawItemState.Selected, this.ForeColor,
                                                                           this.BackColor));
                 }
                 else
                 {
                     OnDrawItem(new System.Windows.Forms.DrawItemEventArgs(e.Graphics, this.Font,
                                                                           irect, i,
                                                                           System.Windows.Forms.DrawItemState.Default, this.ForeColor,
                                                                           this.BackColor));
                 }
                 iRegion.Complement(irect);
             }
         }
     }
     System.Windows.Forms.ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this.BorderColor, System.Windows.Forms.ButtonBorderStyle.Solid);
     base.OnPaint(e);
 }
        void DrawRegionOperation()
        {
            g = this.CreateGraphics();
            Rectangle rect1 = new Rectangle(100, 100, 120, 120);
            Rectangle rect2 = new Rectangle(70, 70, 120, 120);

            Region rgn1 = new Region(rect1);
            Region rgn2 = new Region(rect2);

            g.DrawRectangle(Pens.Blue, rect1);
            g.DrawRectangle(Pens.Red, rect2);

            switch(rgnOperation)
            {
                case RegionOperation.Union:
                    rgn1.Union(rgn2);
                    break;
                case RegionOperation.Complement:
                    rgn1.Complement(rgn2);
                    break;
                case RegionOperation.Intersect:
                    rgn1.Intersect(rgn2);
                    break;
                case RegionOperation.Exclude:
                    rgn1.Exclude(rgn2);
                    break;
                case RegionOperation.Xor:
                    rgn1.Xor(rgn2);
                    break;
                default:
                    break;

            }

            g.FillRegion(Brushes.Tomato, rgn1);

            g.Dispose();
        }
Exemple #6
0
        private void DrawRegionOperations()
        {
            g = this.CreateGraphics();
            // Создаем два прямоугольника
            Rectangle rect1 = new Rectangle(100, 100, 120, 120);
            Rectangle rect2 = new Rectangle(70, 70, 120, 120);
            // Создаем два региона
            Region rgn1 = new Region(rect1);
            Region rgn2 = new Region(rect2);
            // рисуем прямоугольники
            g.DrawRectangle(Pens.Green, rect1);
            g.DrawRectangle(Pens.Black, rect2);

            // обработаем перечисление и вызовем соответствующий метод
            switch (rgnOperation)
            {
                case RegionOperations.Union:
                    rgn1.Union(rgn2);
                    break;
                case RegionOperations.Complement:
                    rgn1.Complement(rgn2);
                    break;
                case RegionOperations.Intersect:
                    rgn1.Intersect(rgn2);
                    break;
                case RegionOperations.Exclude:
                    rgn1.Exclude(rgn2);
                    break;
                case RegionOperations.Xor:
                    rgn1.Xor(rgn2);
                    break;
                default:
                    break;
            }
            // Рисуем регион
            g.FillRegion(Brushes.Blue, rgn1);
            g.Dispose();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            Region region = new Region(e.ClipRectangle);
            Graphics g = e.Graphics;
            g.FillRegion(new SolidBrush(this.BackColor), region);

            for (int i = 0; i < this.Items.Count; i++)
            {
                Rectangle rect = GetItemRectangle(i);
                if (e.ClipRectangle.IntersectsWith(rect))
                {
                    bool selected = (this.SelectionMode == SelectionMode.One && this.SelectedIndex == i)
                        || (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i))
                        || (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i));
                    OnDrawItem(new DrawItemEventArgs(
                        g, Font, rect, i,
                        selected ? DrawItemState.Selected : DrawItemState.Default,
                        ForeColor, BackColor));
                }
                region.Complement(rect);
            }

            base.OnPaint(e);
        }
Exemple #8
0
		// libgdiplus: no intersection results in a clone of sp1 (optimization)
		public void ComplementWithoutIntersection_Large ()
		{
			Region region = new Region (sp4);
			region.Complement (sp1);
			CompareSmallRegion (region, self1, 7, 7);
		}
Exemple #9
0
		public void SmallComplement2 ()
		{
			Region region = new Region (sp2);
			region.Complement (sp1);
			CompareSmallRegion (region, sexclude1, 7, 7);

			RectangleF[] scans = region.GetRegionScans (matrix);
			Assert.AreEqual (2, scans.Length, "GetRegionScans");
			CheckRectF ("[0]", 0, 0, 3, 2, scans[0]);
			CheckRectF ("[1]", 0, 2, 2, 1, scans[1]);
		}
Exemple #10
0
		public void SmallComplement_Self2 ()
		{
			Region region = new Region (sp2);
			region.Complement (sp2);
			CompareSmallRegion (region, sempty, 7, 7);

			RectangleF[] scans = region.GetRegionScans (matrix);
			Assert.AreEqual (0, scans.Length, "GetRegionScans");
		}
Exemple #11
0
        private IntPtr GetHRegion()
        {
            //Define a Clip Region to pass back to WM_NCPAINTs wParam.
            //Must be in Screen Coordinates.
            IntPtr hRgn;
            Rectangle winRect = this.Parent.RectangleToScreen(this.Bounds);
            Rectangle clientRect =
                this.RectangleToScreen(this.ClientRectangle);

            Region updateRegion = new Region(winRect);
            updateRegion.Complement(clientRect);

            using (Graphics g = this.CreateGraphics())
                hRgn = updateRegion.GetHrgn(g);
            updateRegion.Dispose();
            return hRgn;
        }
Exemple #12
0
 /// <summary>
 /// Combines the local clippingRegion with the given region.
 /// </summary>
 /// <param name="combineMode">The combine mode to use.</param>
 /// <param name="region">The region to combine with the clippingRegion.</param>
 private void CombineClippingRegion(CombineMode combineMode, Region region)
 {
   switch(combineMode)
   {
     case CombineMode.Replace:
       clippingRegion = region;
       break;
     case CombineMode.Intersect:
       clippingRegion.Intersect(region);
       break;
     case CombineMode.Union:
       clippingRegion.Union(region);
       break;
     case CombineMode.Xor:
       clippingRegion.Xor(region);
       break;
     case CombineMode.Exclude:
       clippingRegion.Exclude(region);
       break;
     case CombineMode.Complement:
       clippingRegion.Complement(region);
       break;
     default:
       throw new ArgumentOutOfRangeException("combineMode");
   }
 }
Exemple #13
0
		private void UpdateShape3 ()
		{
			if (shape3comboBox.SelectedIndex == -1)
				return;

			if (r1 != null) {
				if (op != null)
					op.Dispose ();
				op = r1.Clone ();
				if (r2 != null) {

					switch (shape3comboBox.SelectedIndex) {
					case 0:
						op.Union (r2);
						break;
					case 1:
						op.Intersect (r2);
						break;
					case 2:
						op.Exclude (r2);
						break;
					case 3:
						op.Complement (r2);
						break;
					case 4:
						op.Xor (r2);
						break;
					}
				}
			}
		}
Exemple #14
0
		public void MultiCombinedPathRegion ()
		{
			// note: seems identical to PathRegion but it test another code path inside libgdiplus
			Region r1 = new Region (sp1);
			r1.Xor (sp2);
			Region r2 = new Region (sp2);
			r2.Complement (sp1);

			Region r = r1.Clone ();
			r.Union (r2);
			RegionData data = r.GetRegionData ();
			Assert.IsNotNull (data.Data, "Data");
			Region region = new Region (data);
			Assert.IsTrue (r.GetBounds (graphic).Equals (region.GetBounds (graphic)), "Bounds");
		}
Exemple #15
0
		public void Complement_383878 ()
		{
			using (Region clipRegion = new Region ()) {
				clipRegion.MakeInfinite ();

				Rectangle smaller = new Rectangle (5, 5, -10, -10);
				Rectangle bigger = new Rectangle (-5, -5, 12, 12);

				clipRegion.Intersect (smaller);
				clipRegion.Complement (bigger);

				Assert.IsFalse (clipRegion.IsEmpty (graphic), "IsEmpty");
				Assert.IsFalse (clipRegion.IsInfinite (graphic), "IsInfinite");

				RectangleF [] rects = clipRegion.GetRegionScans (new Matrix ());
				Assert.AreEqual (2, rects.Length, "Length");
				Assert.AreEqual (new RectangleF (5, -5, 2, 10), rects [0], "0");
				Assert.AreEqual (new RectangleF (-5, 5, 12, 2), rects [1], "1");
			}
		}
		/// <summary>
		/// Handle the paint event and work out if item needs redrawing
		/// </summary>
		/// <param name="e"></param>
    protected override void OnPaint(PaintEventArgs e)
    {
      using (var brush = new SolidBrush(this.BackColor))
      {
        Region region = new Region(e.ClipRectangle);

        e.Graphics.FillRegion(brush, region);
        if (this.Items.Count > 0)
        {
          for (int i = 0; i < this.Items.Count; ++i)
          {
            Rectangle irect = this.GetItemRectangle(i);
            if (e.ClipRectangle.IntersectsWith(irect))
            {
							if ((this.SelectionMode == SelectionMode.One && this.SelectedIndex == i)
							|| (this.SelectionMode == SelectionMode.MultiSimple && this.SelectedIndices.Contains(i))
							|| (this.SelectionMode == SelectionMode.MultiExtended && this.SelectedIndices.Contains(i)))
							{
								DrawItemEventArgs diea = new DrawItemEventArgs(e.Graphics, this.Font,
										irect, i,
										DrawItemState.Selected, this.ForeColor,
										this.BackColor);
								OnDrawItem(diea, e.ClipRectangle);
								base.OnDrawItem(diea);
							}
							else
							{
								DrawItemEventArgs diea = new DrawItemEventArgs(e.Graphics, this.Font,
										irect, i,
										DrawItemState.Default, this.ForeColor,
										this.BackColor);
								OnDrawItem(diea, e.ClipRectangle);
								base.OnDrawItem(diea);
              }
              region.Complement(irect);
            }
          }
        }
      }

      base.OnPaint(e);
		}
Exemple #17
0
		public void EmptyPathWithInfiniteRegion ()
		{
			GraphicsPath gp = new GraphicsPath ();
			Region region = new Region ();
			Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");

			region.Union (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");

			region.Xor (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");

			region.Exclude (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");

			region.Intersect (gp);
			Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");

			region.MakeInfinite ();
			region.Complement (gp);
			Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
		}
Exemple #18
0
		public void TestComplementGroup2 ()
		{

			Bitmap bmp = new Bitmap (600, 800);
			Graphics dc = Graphics.FromImage (bmp);
			Matrix matrix = new Matrix ();
			Rectangle rect1, rect2;
			Region rgn1, rgn2;
			RectangleF [] rects;

			rect1 = new Rectangle (20, 30, 60, 80);
			rect2 = new Rectangle (50, 40, 60, 80);
			rgn1 = new Region (rect1);
			rgn2 = new Region (rect2);
			dc.DrawRectangle (Pens.Green, rect1);
			dc.DrawRectangle (Pens.Red, rect2);
			rgn1.Complement (rgn2);
			dc.FillRegion (Brushes.Blue, rgn1);
			dc.DrawRectangles (Pens.Yellow, rgn1.GetRegionScans (matrix));

			rects = rgn1.GetRegionScans (matrix);

			Assert.AreEqual (2, rects.Length);

			Assert.AreEqual (80, rects[0].X);
			Assert.AreEqual (40, rects[0].Y);
			Assert.AreEqual (30, rects[0].Width);
			Assert.AreEqual (70, rects[0].Height);

			Assert.AreEqual (50, rects[1].X);
			Assert.AreEqual (110, rects[1].Y);
			Assert.AreEqual (60, rects[1].Width);
			Assert.AreEqual (10, rects[1].Height);

		}
Exemple #19
0
		public void TestComplementGroup1 ()
		{
			RectangleF[] rects;
			Region r1  = new Region ();
			Region r2 = new Region ();
			Rectangle rect1 = Rectangle.Empty;
			Rectangle rect2 = Rectangle.Empty;
			Rectangle rect3 = Rectangle.Empty;
			Rectangle rect4 = Rectangle.Empty;
			Rectangle rect5 = Rectangle.Empty;
			Rectangle rect6 = Rectangle.Empty;
			Rectangle rect7 = Rectangle.Empty;


			{ // TEST1

				rect1 = new Rectangle (20, 20, 20, 20);
				rect2 = new Rectangle (20, 80, 20, 10);
				rect3 = new Rectangle (60, 60, 30, 10);

				r1 = new Region (rect1);
				r2 = new Region (rect2);
				r2.Union (rect3);
				r1.Complement (r2);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (2, rects.Length, "TCG1Test1");
				AssertEqualRectangles (new RectangleF (60, 60, 30, 10), rects[0], "TCG1Test2");
				AssertEqualRectangles (new RectangleF (20, 80, 20, 10), rects[1], "TCG1Test3");
			}


			{ // TEST2

				rect1 = new Rectangle (10, 10, 100, 100);
				rect2 = new Rectangle (40, 60, 100, 20);

				r1 = new Region (rect1);
				r1.Complement (rect2);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (1, rects.Length, "TCG2Test1");
				AssertEqualRectangles (new RectangleF (110, 60, 30, 20), rects[0], "TCG2Test2");
			}

			{ // TEST3

				rect1 = new Rectangle (70, 10, 100, 100);
				rect2 = new Rectangle (40, 60, 100, 20);

				r1 = new Region (rect1);
				r1.Complement (rect2);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (1, rects.Length, "TCG3Test1");
				AssertEqualRectangles (new RectangleF (40, 60, 30, 20), rects[0], "TCG3Test2");
			}

			{ // TEST4

				rect1 = new Rectangle (40, 100, 100, 100);
				rect2 = new Rectangle (70, 80, 50, 40);

				r1 = new Region (rect1);
				r1.Complement (rect2);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (1, rects.Length, "TCG4Test1");
				AssertEqualRectangles (new RectangleF (70, 80, 50, 20), rects[0], "TCG4Test2");
			}

			{ // TEST5

				rect1 = new Rectangle (40, 10, 100, 100);
				rect2 = new Rectangle (70, 80, 50, 40);

				r1 = new Region (rect1);
				r1.Complement (rect2);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (1, rects.Length, "TCG5Test1");
				AssertEqualRectangles (new RectangleF (70, 110, 50, 10), rects[0], "TCG5Test2");
			}

			{ // TEST6: Multiple regions

				rect1 = new Rectangle (30, 30, 80, 80);
				rect2 = new Rectangle (45, 45, 200, 200);
				rect3 = new Rectangle (160, 260, 10, 10);
				rect4 = new Rectangle (170, 260, 10, 10);

				r1 = new Region (rect1);
				r1.Complement (rect2);
				r1.Complement (rect3);
				r1.Complement (rect4);

				rects = r1.GetRegionScans (new Matrix ());
				Assert.AreEqual  (1, rects.Length, "TCG6Test1");
				AssertEqualRectangles (new RectangleF (170, 260, 10, 10), rects[0], "TCG6Test2");
			}

		}
Exemple #20
0
		public void EmptyRegionWithInfiniteRegion ()
		{
			Region empty = new Region ();
			empty.MakeEmpty ();
			Assert.IsTrue (empty.IsEmpty (graphic), "IsEmpty");

			Region region = new Region ();
			Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");

			region.Union (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");

			region.Xor (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");

			region.Exclude (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");

			region.Intersect (empty);
			Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");

			region.MakeInfinite ();
			region.Complement (empty);
			Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
		}
Exemple #21
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint" /> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs" /> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Region region = new Region(e.ClipRectangle);

            e.Graphics.FillRegion(new SolidBrush(this.BackColor), region);
            if (this.Items.Count > 0)
            {
                for (int i = 0; i < this.Items.Count; ++i)
                {
                    System.Drawing.Rectangle irect = this.GetItemRectangle(i);
                    if (e.ClipRectangle.IntersectsWith(irect))
                    {
                        this.OnDrawItem(new DrawItemEventArgs(
                            e.Graphics,
                            this.Font,
                            irect,
                            i,
                            this.SelectedIndex == i ? DrawItemState.Selected : DrawItemState.Default,
                            this.ForeColor,
                            this.BackColor));

                        region.Complement(irect);
                    }
                }
            }

            base.OnPaint(e);
        }
		// only draw if item is on-screen
		protected override void OnPaint(PaintEventArgs e)
		{
			var itemRegion = new Region(e.ClipRectangle);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
		    if (!this.RenderParentsBackgroundImage(e)) e.Graphics.FillRegion(new SolidBrush(BackColor), itemRegion);
		    
			if (base.Items.Count > 0)
			{
				for (var i = 0; i < base.Items.Count; ++i)
				{
					var itemRectangle = GetItemRectangle(i);
					if (e.ClipRectangle.IntersectsWith(itemRectangle))
					{
						if ((SelectionMode == SelectionMode.One && SelectedIndex == i) || (SelectionMode == SelectionMode.MultiSimple && SelectedIndices.Contains(i)) ||
						    (SelectionMode == SelectionMode.MultiExtended && SelectedIndices.Contains(i))) OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, itemRectangle, i, DrawItemState.Selected, ForeColor, BackColor));
						else OnDrawItem(new DrawItemEventArgs(e.Graphics, Font, itemRectangle, i, DrawItemState.Default, ForeColor, BackColor));
						itemRegion.Complement(itemRectangle);
					}
				}
			}
			base.OnPaint(e);
		}
Exemple #23
0
        /// <summary>
        ///     Pinta la interfase grafica como a mi me gusta :P
        /// </summary>
        /// <param name="graphics">Objeto Graphics del Formulario</param>
        /// <param name="e">Argumentos del evento Paint</param>
        private void PaintUI(Graphics graphics, PaintEventArgs e)
        {
            Point[] points = { _punto1, _punto2, _punto3, _punto4, _punto5, _punto6 };
                graphics.FillPolygon(this._indicadorBrush, points); // Dibujamos la pestañita.

                Rectangle frm = e.ClipRectangle;
                Rectangle area = VisibleClientRectangle;

                Region formRegion = new Region(frm);
                Region areaRegion = new Region(area);

                formRegion.Complement(areaRegion);

                graphics.FillRegion(this._areaBrush, areaRegion); // área principal
                formRegion.Dispose();
                areaRegion.Dispose();

                Pen linePen = new Pen(this._textoBrush);
                graphics.DrawRectangle(linePen, area);

                if (VisibleWidth > 30 & VisibleHeight > 30) // dibujamos la cruz del centro
                {
                    graphics.DrawLine(linePen, _mitadX, (_mitadY) + 10, _mitadX, (_mitadY) - 10);
                    graphics.DrawLine( linePen, (_mitadX) + 10, _mitadY, (_mitadX) - 10, _mitadY);
                }
                linePen.Dispose();

                // Ancho del area visible de recorte
                graphics.DrawString(VisibleWidth + " px", _guiaFont, _textoBrush, BORDE_ANCHO_INVISIBLE, BORDE_ANCHO_INVISIBLE - 15);

                // Altura del area visible de recorte
                graphics.RotateTransform(90);   // Rotación para que se vea cacheton
                graphics.DrawString(VisibleHeight + " px", _guiaFont, _textoBrush, BORDE_ANCHO_INVISIBLE, -BORDE_ANCHO_INVISIBLE);
        }