C#中如何打印picturebox加载的图片!!!
2个回答
展开全部
PictureBox加载图片的3种方法
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PictureBoxControlTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//从图片文件载入
//下面的路径是写死的,可以获取程序运行路径,这样更灵活
pictureBox1.Image = new Bitmap(@"/Program Files/PictureBoxControlTest/tinyemulator_content.jpg");
}
private void button2_Click(object sender, EventArgs e)
{
//通过imageList控件载入,这种方法的好处是可以设置图片的大小
imageList1.ImageSize = new Size(92,156);
pictureBox1.Image = imageList1.Images[0];
}
private void button3_Click(object sender, EventArgs e)
{
//从程序的资源文件载入.这样做的好处是无需发布图片,已经被整合到程序集中去了.
Bitmap bmp=new Bitmap (System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream
("PictureBoxControlTest.tinyemulator_res.jpg"));
pictureBox1.Image =bmp;
}
private void menuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace PictureBoxControlTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//从图片文件载入
//下面的路径是写死的,可以获取程序运行路径,这样更灵活
pictureBox1.Image = new Bitmap(@"/Program Files/PictureBoxControlTest/tinyemulator_content.jpg");
}
private void button2_Click(object sender, EventArgs e)
{
//通过imageList控件载入,这种方法的好处是可以设置图片的大小
imageList1.ImageSize = new Size(92,156);
pictureBox1.Image = imageList1.Images[0];
}
private void button3_Click(object sender, EventArgs e)
{
//从程序的资源文件载入.这样做的好处是无需发布图片,已经被整合到程序集中去了.
Bitmap bmp=new Bitmap (System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream
("PictureBoxControlTest.tinyemulator_res.jpg"));
pictureBox1.Image =bmp;
}
private void menuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
追问
我不是要加载图片啊 我是要打印加载好的图片啊!
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询