点击按钮投掷系统如何在图片框中插入图像 [英] how to insert image in picturebox on the click of button throw system

查看:130
本文介绍了点击按钮投掷系统如何在图片框中插入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在按钮投掷系统的点击中在图片框中插入图像

解决方案

在按钮点击事件中,您可以通过创建加载图像Image类的对象如

图片img = Image.FromFile( 文件路径); 





然后使用PictureBox的image属性加载它,如

 PictureBox.Image = img; 





之后我想你想保存该图像到另一个位置,你可以使用File类的复制方法,如

 File.Copy(sourceaddress,destinationadress); 





希望这能解决你的问题。


你的问题不清楚..但试试这个。图像应位于运行EXE的文件夹中。



图像image = Image.FromFile(image123.png); 
pictureBox1.Image = image;


如果你想在你的应用程序中保留图像。您可以将其添加到项目的资源中。然后参考下面的例子。



 cnt.BackgroundImage = MyProjectName.Properties.Resources.Button_background; 


how to insert image in picturebox on the click of button throw system

解决方案

On button click event you can load image by creating object of Image class like

Image img=Image.FromFile("path of file");



And then load it by using image property of PictureBox like

PictureBox.Image =img;



After that I guess you want to save that image to another location for that you can use Copy method of File class like

File.Copy(sourceaddress,destinationadress);



Hope this will solve your problem.


Hi, Your Question is not clear.. But try this one. The Image should be in the folder where your EXE is running.

Image image = Image.FromFile("image123.png");
pictureBox1.Image = image;


If you want to keep the image inside your app. you may add it to resources of the project. and then refer it as below example.

cnt.BackgroundImage = MyProjectName.Properties.Resources.Button_background;


这篇关于点击按钮投掷系统如何在图片框中插入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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