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

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 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch