Graphics.MeasureString : Graphics « System.Drawing « C# / C Sharp by API






Graphics.MeasureString

   


using System;
using System.Drawing;
using System.Windows.Forms;
   
class SysInfoColumns: Form
{
     public static void Main()
     {
          Application.Run(new SysInfoColumns());
     }
     public SysInfoColumns()
     {
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          Graphics grfx  = pea.Graphics;
          Brush    brush = new SolidBrush(ForeColor);
          SizeF    sizef;
          float    cxCol, y = 0;
          int      cySpace;
   
          sizef   = grfx.MeasureString("ArrangeStartingPosition ", Font);
          cxCol   = sizef.Width;
          cySpace = Font.Height;
   
          grfx.DrawString("ArrangeDirection", Font, brush, 0, y);
          grfx.DrawString(SystemInformation.ArrangeDirection.ToString(), 
                          Font, brush, cxCol, y);
          y += cySpace;
   
          grfx.DrawString("ArrangeStartingPosition", Font, brush, 0, y);
          grfx.DrawString(
               SystemInformation.ArrangeStartingPosition.ToString(), 
               Font, brush, cxCol, y);
          y += cySpace;
   
          grfx.DrawString("BootMode", Font, brush, 0, y);
          grfx.DrawString(SystemInformation.BootMode.ToString(), 
                          Font, brush, cxCol, y);
          y += cySpace;
   
          grfx.DrawString("Border3DSize", Font, brush, 0, y);
          grfx.DrawString(SystemInformation.Border3DSize.ToString(), 
                          Font, brush, cxCol, y);
          y += cySpace;
   
          grfx.DrawString("BorderSize", Font, brush, 0, y);
          grfx.DrawString(SystemInformation.BorderSize.ToString(), 
                          Font, brush, cxCol, y);
          y += cySpace;
   
          grfx.DrawString("CaptionButtonSize", Font, brush, 0, y);
          grfx.DrawString(SystemInformation.CaptionButtonSize.ToString(), 
                          Font, brush, cxCol, y);

     }
}

   
    
    
  








Related examples in the same category

1.Graphics.Clear
2.Graphics.CopyFromScreen
3.Graphics.DashCap
4.Graphics.Dispose()
5.Graphics.DpiX
6.Graphics.DpiY
7.Graphics.DrawArc
8.Graphics.DrawBeziers
9.Graphics.DrawEllipse
10.Graphics.DrawIcon(Icon icon, int x, int y)
11.Graphics.DrawImage(Image i, int x, int y);
12.Graphics.DrawImage(Image img, int x, int y, int width, int height)
13.Graphics.DrawImage(im, rec, recPart, GraphicsUnit.Pixel)
14.Graphics.DrawImage(Image, Points[])
15.Graphics.DrawLine(Pen p, int x0,int y0, int x1, int y1)
16.Graphics.DrawLine(Pen,Point point1, Point point2)
17.Graphics.DrawLines(Pen pen, Point[] points)
18.Graphics.DrawPie
19.Graphics.DrawRectangle
20.Graphics.DrawRectangles
21.Graphics.DrawString
22.Graphics.EnumerateMetafileProc
23.Graphics.FillClosedCurve
24.Graphics.FillEllipse
25.Graphics.FillEllipse(Brush brush,int x, int y,int width,int height)
26.Graphics.FillPath(Brushes.AliceBlue, myPath);
27.Graphics.FillPolygon
28.Graphics.FillRectangle
29.Graphics.FillRectangles
30.Graphics.FillRegion
31.Graphics.FromHwnd()
32.Graphics.FromImage
33.Graphics.InterpolationMode
34.Graphics.PageScale
35.Graphics.PageUnit
36.Graphics.PixelOffsetMode
37.Graphics.ReleaseHdc
38.Graphics.RotateTransform
39.Graphics.ScaleTransform
40.Graphics.SetClip
41.Graphics.SetClip(path, (CombineMode)miCombineMode.Index)
42.Graphics.SmoothingMode
43.Graphics.TextRenderingHint
44.Graphics.Transform
45.Graphics.TranslateClip
46.Graphics.TranslateTransform
47.Graphics.VisibleClipBounds