示例#1
0
        private static void DoPaint(IGraphics g, Label label)
        {
            Rectangle2 rect = new Rectangle2(GraphUtils.ToPointF2(label.Location), GraphUtils.ToSizeF2(label.Size));

            g.FillRectangle(new Brush2(GraphUtils.ToColor2(label.BackColor)), rect.X, rect.Y, label.Width - label.Margin.Left - label.Margin.Right,
                            label.Height - label.Margin.Top - label.Margin.Bottom);
            StringFormat2 format = new StringFormat2 {
                Alignment = StringAlignment2.Near, LineAlignment = StringAlignment2.Near
            };

            g.DrawString(label.Text, GraphUtils.ToFont2(label.Font), new Brush2(GraphUtils.ToColor2(label.ForeColor)), rect, format);
        }
示例#2
0
        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);
        }