先添加引用你自定义类(dll文件)
然后在代码中添加
using Pint;

解决方案 »

  1.   

    添加引用了吗,就是把你的写类库生成的dll引入。
      

  2.   

    没有这个一般是Console.WirteLine()
      

  3.   

    如果你的自定义类与你的页面不属同一命名空间的话,必须先using,然后才能调用方法和属性
      

  4.   

    我创建了一个Print类,要在另一个类中引用Print类,但用USING 试了还是报错
      

  5.   

    如果你没有用using pint的话就用上则可进行引用,如用了的话,具体什么原因将代码贴出来
      

  6.   

    我的意思是对dll文件
    添加引用了吗,就是把你的写类库生成的dll引入。
      

  7.   

    第一个类的代码:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Windows.Forms;
    using System.Xml;
    using System.Drawing.Printing;namespace remoteprint
    {
    /// <summary>
    /// UserControl1 的摘要说明。
    /// </summary>
    public class PrintControl : System.Windows.Forms.UserControl
    {
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.Label label1;
    private System.Drawing.Printing.PrintDocument printDocument1;
    private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
    private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1; /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; private void pd_PrintPage(object sender, PrintPageEventArgs ev) 
    {
    Graphics g = ev.Graphics;
    bool HasMorePages = false;
    PrintElement printElement = null;
        
    foreach(XmlNode node in doc["root"]["reporttable"].ChildNodes)
    {
    printElement = Parser.CreateElement(node);//调用解析器生成相应的对象
    try
    {
    HasMorePages = printElement.Draw(g);//是否需要分页
    }
    catch(Exception ex)
    {
    this.label1.Text = ex.Message;
    }
    } //在页底中间输出页码
    Font font = new Font("黑体", 12.0f);
    Brush brush = new SolidBrush(Color.Black);
    g.DrawString("第 " + Pages.ToString() + " 页",
    font,brush,ev.MarginBounds.Width / 2 + ev.MarginBounds.Left - 30, 
    ev.PageBounds.Height - 60); if(HasMorePages)
    {
    Pages++;
    }
    ev.HasMorePages = HasMorePages;
    }
    }
    }
    第二个:
    using System;
    using System.Xml;
    using System.Drawing;namespace RemotePrint
    {
    public class PrintElement
    {
    public PrintElement()
    {
    } public virtual bool Draw(Graphics g)
    {
    return false;
    }
    }
    }
    找不到类型或命名空间名称“PrintElement”(是否缺少 using 指令或程序集引用?)
      

  8.   

    第一个类:
    namespace remoteprint
    改成:
    namespace RemotePrint注意大小写
      

  9.   

    谢谢timmy3310(tim) ,正如你言