Пример #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);
        }
 public Size2 MeasureString(string text, Font2 font, float width)
 {
     return(GraphUtils.ToSizeF2(gc.MeasureString(text, GraphUtils.ToFont(font), (int)width)));
 }
Пример #3
0
 public Size2 MeasureString(string text, Font2 font, float width)
 {
     return(GraphUtils.ToSizeF2(TextRenderer.MeasureText(text, GraphUtils.ToFont(font))));
 }
 public Size2 MeasureString(string text, Font2 font)
 {
     return(GraphUtils.ToSizeF2(gc.MeasureString(text, GraphUtils.ToFont(font))));
 }