小编ala*_*oma的帖子

打印图片框

当我尝试打印a时PictureBox,ArgumentException抛出一个(参数无效).

这是打印功能:

void pdGroupBox_PrintPage(object sender, PrintPageEventArgs e)
{
    foreach(Control control in _GbFrm.Controls)
        DrawControls(control, e.Graphics);
}

private void DrawControls(Control control,Graphics g)
{
    var font = new Font("Arial", 10);
    var brush = new SolidBrush(Color.Black);
    var drawFormat = new StringFormat
    {
        FormatFlags = StringFormatFlags.DirectionRightToLeft
    };

    if (control is Label)
    {
        if ((string)control.Tag == "1") //Treated with 1 columns of fields.
        {
            g.DrawString(
                control.Text, font, brush,
                new Rectangle(control.Location.X - 160, control.Location.Y, control.Size.Width + 10, control.Size.Height),
                drawFormat);
        }
        if ((string)control.Tag == …
Run Code Online (Sandbox Code Playgroud)

c# winforms

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

winforms ×1