用GDI+编程,画出来这个打印就是
http://community.csdn.net/Expert/topic/3278/3278050.xml

解决方案 »

  1.   

    关键是我的控件很长(A4),放在一个面板里面。搞不定阿。。
    [System.Runtime.InteropServices.DllImport("gdi32.dll")]
    public static extern long BitBlt (IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
    private Bitmap memoryImage;private void button1_Click(object sender, System.EventArgs e)
    {
    CaptureScreen();
    //printPreviewDialog1.Show();
    pd.Print();
    } private void CaptureScreen()
    {
    Graphics mygraphics = Graphics.FromHwnd(table1.Handle);//table1.CreateGraphics();
    Size s = new Size(table1.ClientRectangle.Width, table1.ClientRectangle.Height);
    memoryImage = new Bitmap(s.Width, s.Height, mygraphics);
    Graphics memoryGraphics = Graphics.FromImage(memoryImage);
    IntPtr dc1 = mygraphics.GetHdc();
    IntPtr dc2 = memoryGraphics.GetHdc();
    BitBlt(dc2, 0, 0, table1.ClientRectangle.Width, table1.ClientRectangle.Height, dc1,table1.Left,table1.Top, 13369376);
    mygraphics.ReleaseHdc(dc1);
    memoryGraphics.ReleaseHdc(dc2);
    }