Exemplo n.º 1
0
        protected void DrawTextBox(Graphics g, PointF pt)
        {
            SizeF size = Size(g);

            using (Pen p = Border.CreatePen())
                using (Brush br = Background.CreateBrush())
                {
                    RectangleF rect = new RectangleF(pt, size);
                    g.FillRectangle(br, rect);
                    g.DrawRectangle(p, rect.X, rect.Y, rect.Width, rect.Height);
                }

            using (Font f = TextFont.CreateFont())
                using (Brush br = TextFont.CreateBrush())
                {
                    g.DrawString(Text, f, br, pt);
                }
        }
Exemplo n.º 2
0
 protected SizeF Size(Graphics g)
 {
     using (Font f = TextFont.CreateFont())
         return(g.MeasureString(text, f));
 }