liwanyi2012 2016-03-08 12:58 采纳率: 40%
浏览 4600

c#我这样写代码后,为什么运行后窗体不显示picturebox中的图片,要怎样才能显示

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _1340226147
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

    }

    private void Form1_Load(object sender, EventArgs e)
    {

    }
    private void AddPictureBox(int left, int top)
    {

    }

    private void axBarCodeCtrl1_Enter(object sender, EventArgs e)
    {
        axBarCodeCtrl1.Value = "1340226147";
    }

    private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
    {
        Graphics g = e.Graphics;
        Bitmap bb = BarCodeTest.ControlBitmap.getControlBitmap(axBarCodeCtrl1);
        g.DrawString("***", new Font("宋体", 30, FontStyle.Bold), new SolidBrush(Color.Black), 10, 10);
        g.DrawImage(bb, 10, 100);
        //Bitmap ab = 
    }

    private void button1_Click(object sender, EventArgs e)
    {
        printDocument1.Print();
    }

    private void Form1_Paint(object sender, PaintEventArgs e)
    {

    }

}

}

  • 写回答

2条回答 默认 最新

  • threenewbee 2016-03-08 16:07
    关注

    Bitmap bb = BarCodeTest.ControlBitmap.getControlBitmap(axBarCodeCtrl1);
    bb.Save()保存到文件看看生成的bmp有没有问题。

    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥15 Pwm双极模式H桥驱动控制电机
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换