private static void DoPaint(IGraphics g, TextBox textBox) { g.FillRectangle(new Brush2(GraphUtils.ToColor2(textBox.BackColor)), textBox.Location.X, textBox.Location.Y, textBox.Width - textBox.Margin.Left - textBox.Margin.Right, textBox.Height - textBox.Margin.Top - textBox.Margin.Bottom); Rectangle2 rect = new Rectangle2(GraphUtils.ToPointF2(textBox.Location), GraphUtils.ToSize2(textBox.Size)); StringFormat2 format = new StringFormat2 { Alignment = StringAlignment2.Near, LineAlignment = StringAlignment2.Near }; g.DrawString(textBox.Text, GraphUtils.ToFont2(textBox.Font), new Brush2(GraphUtils.ToColor2(textBox.ForeColor)), rect, format); }