补充说明:在WEBFORM下,不是在WINFORM下!

解决方案 »

  1.   

    取得对应当前font对象,提取对应高度和宽度
    乘以字符数
      

  2.   

    Font font=new Font("Arial",9);
    Graphics grap=this.CreateGraphics();
    context=ds.Tables[0].Rows[j][i].ToString();
    sizef=grap.MeasureString(context,font);
      

  3.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;SizeF sizef=new SizeF();
    Font font=new Font("Arial",9);
    Graphics grap=this.CreateGraphics();sizef=grap.MeasureString("测试用12345ABC",font);
    int len=sizef.Width;
      

  4.   

    To whmjw(找工作中) :
    在WEBFORM中以下这一行编译不能通过
    Graphics grap=this.CreateGraphics();
    this中根本没有此CreateGraphics事件。
      

  5.   

    WINFORM的取得方法我早就知道了,就是不知道WEBFORM怎么得!