Hola

Páginas: 5 (1109 palabras) Publicado: 14 de febrero de 2013
Unidad 2

Graficación

environments
• A window on a screen (a form)

Unidad 2
Graficación 2D

• A page being sent to a printer • A bitmap (an image) in memory

Drawing surfaces
• Size • pixel resolution • and color depth

Ing. Carlos A. Guerrero C.

1

Unidad 2

Graficación

RGB Values
Color c = Color.FromArgb(100, 100, 255); Brush b = new SolidBrush(c);g.FillRectangle(b, ClientRectangle);

Predefined Colors
Color c1 = Color.LavenderBlush; Color c2 = Color.Red;

Metodos de la clase graphics
• private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics g = e.Graphics; g.FillRectangle(Brushes.White, this.ClientRectangle); // Create two color instances with different alpha components Color c1 = Color.FromArgb(100, Color.Blue);Color c2 = Color.FromArgb(50, Color.Green); // Now draw a red opaque ellipse g.FillEllipse(Brushes.Red, 20, 20, 80, 80); // Now draw a rectangle, filled with the semitransparent blue g.FillRectangle(new SolidBrush(c1), 60, 80, 60, 60); // Now draw a polygon, filled with the almost-transparent green Point[] pa = new Point[] { new Point(150, 40), new Point(90, 40), new Point(90, 120)};g.FillPolygon(new SolidBrush(c2), pa); }
• • • • • • • • • • • • • • • • • • • • Clear DrawArc DrawBezier DrawCurve DrawEllipse DrawIcon DrawImage DrawLine DrawPath DrawPie DrawPolygon DrawRectangle DrawString FillClosedCurve FillEllipse FillPath FillPie FillPolygon FillRectangle FillRegion

Ing. Carlos A. Guerrero C.

2

Unidad 2

Graficación

e.Graphics.DrawLine(Pens.Black, 1, 2, 5, 2);e.Graphics.DrawLine(Pens.Black, 1, 1, 4, 4);

e.Graphics.DrawRectangle(Pens.Black, 1, 0, 5, 4);

Ing. Carlos A. Guerrero C.

3

Unidad 2

Graficación

e.Graphics.FillRectangle(Brushes.Black, 1, 0, 5, 4);

e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.FillRectangle(Brushes.Black, 1, 0, 5, 4);

Units of Measurement

Unit of Measure Display Document Inch MillimeterPixel Point

Physical Size 1/96 inch 1/300 inch 1 inch 1 millimeter 1 pixel (the default) 1/72 inch

Ing. Carlos A. Guerrero C.

4

Unidad 2

Graficación

Coordinate Data Types
Data Type Point PointF Size SizeF Rectangle Class/Structure Description Structure Structure Structure Structure Structure Represents a single point, expressed with integer precision. A Point structure contains Xand Y properties. Represents a single point, expressed with floating-point precision. A PointF structure contains X and Y properties. Represents a size, expressed with integer precision. A Size structure contains Width and Height properties. Represents a size, expressed with floating-point precision. A SizeF structure contains Width and Height properties. Represents a rectangle, expressed withinteger precision. Rectangles are expressed in terms of position and size (which may be expressed using coordinates and dimensions, or using Point and Size objects). Represents a rectangle, expressed with floating-point precision. Encapsulates a series of connected lines, curves, arcs, pie shapes, polygons, rectangles, and more. Describes the interior of a graphics shape composed of rectangles andpaths (GraphicsPath objects).

Pen, brush
• Pen
– draw lines – Curves – outlines of shapes

• Brush
– fill shapes with colors and patterns

RectangleF GraphicsPath Region

Structure Class Class

• Pen p = new Pen(Color.Black);
Graphics g = e.Graphics; g.FillRectangle(Brushes.White, this.ClientRectangle); Pen p = new Pen(Color.Black); g.DrawLine(p, 0, 0, 100, 100); p.Dispose();// Specified color, default width (1px) Pen p1 = new Pen(myColor); // Specified color, specified width (px) Pen p2 = new Pen(myColor, myWidth); // Specified brush, default width (1px) Pen p3 = new Pen(myBrush); // Specified brush, specified width (px) Pen p4 = new Pen(myBrush, myWidth);

Ing. Carlos A. Guerrero C.

5

Unidad 2

Graficación

private void Form1_Paint(object sender,...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • hola hola hola hola
  • hola hola hola hola hola
  • hola hola hhola hola y hola
  • hola hola hola
  • Hola Hola Hola
  • Hola Hola Hola
  • hola hola hola
  • Hola hola

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS