Graphics g = this.CreateGraphics();Label的属性TextAlign设置一下看看是不是你要的效果!

解决方案 »

  1.   

    Label的属性TextAlign已经设置成MiddleCenter了,但还是不行!!!
    问题的关键在于缩放比例上!!!
      

  2.   

    1.你把label 的属性visible设置为 false;这样你的画的图形的操作能够在Form上显示!
    2. protected override void OnPaint(PaintEventArgs e)
    {
    Graphics g = e.Graphics;
    //RectangleF rect = new RectangleF(label1.Location,label1.Size);
    using (Pen RedPen = new Pen(Color.Red,1))
    {
    float x = label1.Location.X+(label1.Width-label1.Text.Length*label1.Font.Size)/2;
    float y = label1.Location.Y+(label1.Height-label1.Font.Size)/2;
    g.DrawRectangle(RedPen,x,y,label1.Text.Length*label1.Font.Size,label1.Font.Size); StringFormat sf = new StringFormat();
    sf.Alignment = StringAlignment.Center; g.DrawString(label1.Text,label1.Font,Brushes.Green,new RectangleF(x,y,label1.Text.Length*label1.Font.Size,label1.Font.Size),sf);
    }
    }
    我是这样做的,效果还不是很好,你看看!我得比例没有你那么麻烦!
      

  3.   

    首先,修改Label的AutoSize属性为true,把其放置到窗体的中间。那么打印的时候,把整个窗体的图放到纸张的中间即可。
    15.1 How do I print a form? 
    http://www.syncfusion.com/FAQ/WinForms/FAQ_c55c.asp#q491q
    稍微修改一下,按比例扩大或缩放窗体图