我需要在C#中有多个页面的帮助 [英] I need a help with multiple pages in C#

查看:64
本文介绍了我需要在C#中有多个页面的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了这段代码而且我有一个问题,因为我需要在新页面中放置第五条记录但是当列表结束时我的打印预览不会显示更多的1页。

请各位帮助我如何解决这个问题



I wrote this code and I have a problem because I need a place fifth record in new page but when the list is end my print preview dont show more of 1 page.
Please guys help me How I can fix that

    // Create string to draw.
    String drawString = "Организация: Петко Ангелов БГ ЕООД";
    String drawBulstat = "Булстат: 160074586";
    String drawRKO = "Разходен касов ордер        No: ";
    String drawStart_date = "" + start_date.Text;

    String drawTo = "Да се плати на: " + driver_1.Text;
    String drawTo_2 = "Да се плати на: " + driver_2.Text;

    String drawOsnovanie = "Аванс за композиция: влекач " + truck_number.Text + " ремарке " + trailer_number.Text + "и дестинация " + destination.Text;
    String drawStringSum = "Сума:" + (Convert.ToInt32(advance_sum.Text) / 2).ToString() + " " + curency.Text;

    String drawUser = "Дал сума: " + username_txt.Text;
    String drawDriver_1 = driver_1.Text;
    String drawDriver_2 = driver_2.Text;

    // Create font and brush.
    Font drawFont = new Font("Times New Roman", 14);
    SolidBrush drawBrush = new SolidBrush(Color.Black);

    // Create rectangle for drawing.
    float x = 80.0F;
    float y_1 = 110.0F;
    float y = 50.0F;
    // Координати за вторият ордер
    float y_2 = 295.0F;
    // Координати за третият ордер
    float y_3 = 540.0F;
    // Координати за четвъртият ордер
    float y_4 = 785.0F;
    // Координати за пети ордер
    float y_5 = 1030.0F;
    float width = 400.0F;
    float height = 30.0F;



    RectangleF drawRect = new RectangleF(x, y, width, height);
    RectangleF drawRect_1 = new RectangleF(x + 400, y, width, height);
    RectangleF drawRect_2 = new RectangleF(x, y + 30, width, height + 30);
    RectangleF drawRect_3 = new RectangleF(x + 400, y + 30, width, height + 30);
    RectangleF drawRect_4 = new RectangleF(x, y_1, width + 300, height);
    RectangleF drawRect_5 = new RectangleF(x, y_1 + 30, width + 300, height + 15);
    RectangleF drawRect_6 = new RectangleF(x, y_1 + 75, width + 300, height);
    RectangleF drawRect_7 = new RectangleF(x, y_1 + 105, width, height + 15);
    RectangleF drawRect_8 = new RectangleF(x + 400, y_1 + 105, width - 100, height + 15);

    //Втори ордер при двама шофьори

    RectangleF drawRect_9 = new RectangleF(x, y_2, width, height);
    RectangleF drawRect_10 = new RectangleF(x + 400, y_2, width - 100, height);
    RectangleF drawRect_11 = new RectangleF(x, y_2 + 30, width, height);
    RectangleF drawRect_12 = new RectangleF(x + 400, y_2 + 30, width - 100, height);
    RectangleF drawRect_13 = new RectangleF(x, y_2 + 60, width + 300, height);
    RectangleF drawRect_14 = new RectangleF(x, y_2 + 90, width + 300, height + 15);
    RectangleF drawRect_15 = new RectangleF(x, y_2 + 135, width + 300, height);
    RectangleF drawRect_16 = new RectangleF(x, y_2 + 165, width, height + 15);
    RectangleF drawRect_17 = new RectangleF(x + 400, y_2 + 165, width - 100, height + 15);

    //Трети ордер при двама шофьори

    RectangleF drawRect_18 = new RectangleF(x, y_3, width, height);
    RectangleF drawRect_19 = new RectangleF(x + 400, y_3, width - 100, height);
    RectangleF drawRect_20 = new RectangleF(x, y_3 + 30, width, height);
    RectangleF drawRect_21 = new RectangleF(x + 400, y_3 + 30, width - 100, height);
    RectangleF drawRect_22 = new RectangleF(x, y_3 + 60, width + 300, height);
    RectangleF drawRect_23 = new RectangleF(x, y_3 + 90, width + 300, height + 15);
    RectangleF drawRect_24 = new RectangleF(x, y_3 + 135, width + 300, height);
    RectangleF drawRect_25 = new RectangleF(x, y_3 + 165, width, height + 15);
    RectangleF drawRect_26 = new RectangleF(x + 400, y_3 + 165, width - 100, height + 15);

    //Четвърти ордер при двама шофьори

    RectangleF drawRect_27 = new RectangleF(x, y_4, width, height);
    RectangleF drawRect_28 = new RectangleF(x + 400, y_4, width - 100, height);
    RectangleF drawRect_29 = new RectangleF(x, y_4 + 30, width, height);
    RectangleF drawRect_30 = new RectangleF(x + 400, y_4 + 30, width - 100, height);
    RectangleF drawRect_31 = new RectangleF(x, y_4 + 60, width + 300, height);
    RectangleF drawRect_32 = new RectangleF(x, y_4 + 90, width + 300, height + 15);
    RectangleF drawRect_33 = new RectangleF(x, y_4 + 135, width + 300, height);
    RectangleF drawRect_34 = new RectangleF(x, y_4 + 165, width, height + 15);
    RectangleF drawRect_35 = new RectangleF(x + 400, y_4 + 165, width - 100, height + 15);

    //Пети ордер при двама шофьори

    RectangleF drawRect_36 = new RectangleF(x, y_5, width, height);
    RectangleF drawRect_37 = new RectangleF(x + 400, y_5, width - 100, height);
    RectangleF drawRect_38 = new RectangleF(x, y_5 + 30, width, height);
    RectangleF drawRect_39 = new RectangleF(x + 400, y_5 + 30, width - 100, height);
    RectangleF drawRect_40 = new RectangleF(x, y_5 + 60, width + 300, height);
    RectangleF drawRect_41 = new RectangleF(x, y_5 + 90, width + 300, height + 15);
    RectangleF drawRect_42 = new RectangleF(x, y_5 + 135, width + 300, height);
    RectangleF drawRect_43 = new RectangleF(x, y_5 + 165, width, height + 15);
    RectangleF drawRect_44 = new RectangleF(x + 400, y_5 + 165, width - 100, height + 15);





    // Draw rectangle to screen.
    Pen blackPen = new Pen(Color.Black);
    e.Graphics.DrawRectangle(blackPen, x, y, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y, width, height + 30);
    e.Graphics.DrawRectangle(blackPen, x + 400, y, width - 100, height + 30);
    e.Graphics.DrawRectangle(blackPen, x, y_1, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_1 + 30, width + 300, height + 15);
    e.Graphics.DrawRectangle(blackPen, x, y_1 + 75, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_1 + 105, width, height + 15);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_1 + 105, width - 100, height + 15);



    //Втори ордер

    e.Graphics.DrawRectangle(blackPen, x, y_2, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_2, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_2 + 30, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_2 + 30, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_2 + 60, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_2 + 90, width + 300, height + 15);
    e.Graphics.DrawRectangle(blackPen, x, y_2 + 135, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_2 + 165, width, height + 15);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_2 + 165, width - 100, height + 15);

    //Трети ордер

    e.Graphics.DrawRectangle(blackPen, x, y_3, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_3, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_3 + 30, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_3 + 30, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_3 + 60, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_3 + 90, width + 300, height + 15);
    e.Graphics.DrawRectangle(blackPen, x, y_3 + 135, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_3 + 165, width, height + 15);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_3 + 165, width - 100, height + 15);

    //Четвърти ордер

    e.Graphics.DrawRectangle(blackPen, x, y_4, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_4, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_4 + 30, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_4 + 30, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_4 + 60, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_4 + 90, width + 300, height + 15);
    e.Graphics.DrawRectangle(blackPen, x, y_4 + 135, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_4 + 165, width, height + 15);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_4 + 165, width - 100, height + 15);

    //Пети ордер

    e.Graphics.DrawRectangle(blackPen, x, y_5, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_5, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_5 + 30, width, height);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_5 + 30, width - 100, height);
    e.Graphics.DrawRectangle(blackPen, x, y_5 + 60, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_5 + 90, width + 300, height + 15);
    e.Graphics.DrawRectangle(blackPen, x, y_5 + 135, width + 300, height);
    e.Graphics.DrawRectangle(blackPen, x, y_5 + 165, width, height + 15);
    e.Graphics.DrawRectangle(blackPen, x + 400, y_5 + 165, width - 100, height + 15);


    // Set format of string.
    StringFormat drawFormat = new StringFormat();
    drawFormat.Alignment = StringAlignment.Near;

    // Draw string to screen.
    e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect, drawFormat);
    e.Graphics.DrawString(drawBulstat, drawFont, drawBrush, drawRect_1, drawFormat);
    e.Graphics.DrawString(drawRKO, drawFont, drawBrush, drawRect_2, drawFormat);
    e.Graphics.DrawString(drawStart_date, drawFont, drawBrush, drawRect_3, drawFormat);
    e.Graphics.DrawString(drawTo, drawFont, drawBrush, drawRect_4, drawFormat);
    e.Graphics.DrawString(drawOsnovanie, drawFont, drawBrush, drawRect_5, drawFormat);
    e.Graphics.DrawString(drawStringSum, drawFont, drawBrush, drawRect_6, drawFormat);
    e.Graphics.DrawString(drawUser, drawFont, drawBrush, drawRect_7, drawFormat);
    e.Graphics.DrawString(drawDriver_1, drawFont, drawBrush, drawRect_8, drawFormat);
    //Втори ордер
    e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect_9, drawFormat);
    e.Graphics.DrawString(drawBulstat, drawFont, drawBrush, drawRect_10, drawFormat);
    e.Graphics.DrawString(drawRKO, drawFont, drawBrush, drawRect_11, drawFormat);
    e.Graphics.DrawString(drawStart_date, drawFont, drawBrush, drawRect_12, drawFormat);
    e.Graphics.DrawString(drawTo, drawFont, drawBrush, drawRect_13, drawFormat);
    e.Graphics.DrawString(drawOsnovanie, drawFont, drawBrush, drawRect_14, drawFormat);
    e.Graphics.DrawString(drawStringSum, drawFont, drawBrush, drawRect_15, drawFormat);
    e.Graphics.DrawString(drawUser, drawFont, drawBrush, drawRect_16, drawFormat);
    e.Graphics.DrawString(drawDriver_1, drawFont, drawBrush, drawRect_17, drawFormat);
    //Трети ордер
    e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect_18, drawFormat);
    e.Graphics.DrawString(drawBulstat, drawFont, drawBrush, drawRect_19, drawFormat);
    e.Graphics.DrawString(drawRKO, drawFont, drawBrush, drawRect_20, drawFormat);
    e.Graphics.DrawString(drawStart_date, drawFont, drawBrush, drawRect_21, drawFormat);
    e.Graphics.DrawString(drawTo, drawFont, drawBrush, drawRect_22, drawFormat);
    e.Graphics.DrawString(drawOsnovanie, drawFont, drawBrush, drawRect_23, drawFormat);
    e.Graphics.DrawString(drawStringSum, drawFont, drawBrush, drawRect_24, drawFormat);
    e.Graphics.DrawString(drawUser, drawFont, drawBrush, drawRect_25, drawFormat);
    e.Graphics.DrawString(drawDriver_1, drawFont, drawBrush, drawRect_26, drawFormat);
    //Четвърти ордер
    e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect_27, drawFormat);
    e.Graphics.DrawString(drawBulstat, drawFont, drawBrush, drawRect_28, drawFormat);
    e.Graphics.DrawString(drawRKO, drawFont, drawBrush, drawRect_29, drawFormat);
    e.Graphics.DrawString(drawStart_date, drawFont, drawBrush, drawRect_30, drawFormat);
    e.Graphics.DrawString(drawTo_2, drawFont, drawBrush, drawRect_31, drawFormat);
    e.Graphics.DrawString(drawOsnovanie, drawFont, drawBrush, drawRect_32, drawFormat);
    e.Graphics.DrawString(drawStringSum, drawFont, drawBrush, drawRect_33, drawFormat);
    e.Graphics.DrawString(drawUser, drawFont, drawBrush, drawRect_34, drawFormat);
    e.Graphics.DrawString(drawDriver_2, drawFont, drawBrush, drawRect_35, drawFormat);

}

推荐答案

查看这些链接



http://msdn.microsoft.com/ en-us / library / cwbe712d%28v = vs.110%29.aspx [ ^ ]



http://www.dotnetcurry.com/showarticle.aspx?ID=104 [ ^ ]
check these links

http://msdn.microsoft.com/en-us/library/cwbe712d%28v=vs.110%29.aspx[^]

http://www.dotnetcurry.com/showarticle.aspx?ID=104[^]


这篇关于我需要在C#中有多个页面的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆