如下代码:protected override void OnPaint(PaintEventArgs e)
{
    //......................
    //其它代码
    // ......................    e.Graphics.DrawString(str, this.Font, m_brText, rc, fmt);    // ...............
    //其它代码
    // ...............
}
因为是OnPaint函数所以会不只一次进来,但是第一次进来不会有问题,第二次进来就会在上面的DrawString()函数中出现异常,提示“参数无效,“this.Font.Height”引发了“System.ArgumentException””类型的异常,不知道是什么原因,有哪位碰到过这种问题,请赐教。。

解决方案 »

  1.   

    Font 定义字符串的文本格式能点出height来?
      

  2.   

    g.DrawString("button", new Font(FontFamily.GenericMonospace, 12f), Brushes.Red, new PointF(10, 20));
      

  3.   

    你的代码太少了,猜不透!还有,你的this.Font.Height指的是当前窗体字体的高度,而你给出的代码并没有出现this.Font.Height,郁闷、、、、、、
      

  4.   

    using (Graphics g = this.CreateGraphics())
        {
            g.DrawString("", this.Font, Brushes.Black, 0, 0);
            g.DrawString("", this.Font,SystemBrushes.WindowText, 10f, 10f);
        }
      

  5.   


    http://msdn.microsoft.com/zh-cn/library/21kdfbzs(VS.90).aspx
      

  6.   

    ArgumentNullException
    brush 为 空引用
    - 或 -
    String为 空引用
     
      

  7.   

       已经搞定了,是因为第一次进来出去时我将FONT释放了。