如何将数据(图像,...)插入Winform应用程序 [英] How Can I Insert Data (Images,..) To A Winform Application

查看:78
本文介绍了如何将数据(图像,...)插入Winform应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好:)

我在做贺卡编辑器应用程序。我想插入用户在创建一张卡片时可以使用的背景图片。我该怎么做?谢谢你的帮助:D

hello:)
I'm doing my greeting card editor application. and I want to insert pictures of backgrounds that the user can use when creating his one card. how can I do it? thank you for helping:D

推荐答案

"Don't know. I'm a little bit confused!! please can you send me the code in c# language. I'm not able to deal with images in a winform. I don't know what to do. it's my first experience."

我们在这里帮助人们学习如何编程,以及应用程序设计问题,并帮助人们在编写代码时遇到困难。除了极少数例外,这里没有人会向你发送代码。



重要的是你采取主动并开始编写代码。但是,如果您尚未做好准备,那么您至少可以搜索CodeProject以查找使用PictureBox和ImageList的文章,并向您展示如何创建缩略图。



从研究WinForm PictureBox控件开始。将一个PictureBox放在一个Form上,并编写代码以将Image加载到它中。



了解如何创建从文件中读取的图像的ThumbNail。 />


在表单上放置一个ListView,并将其View属性设置为LargeIcon或SmallIcon。



在表单上放置一个ImageList组件,并向其添加图像。



根据您是否将ListView的'LargeImageList或'SmallImageList属性设置为ImageList将'View属性指定为'LargeIcon或'SmallIcon。



使用带有字符串的ListViewItem构造函数将项添加到Listview,并将ImageList中的索引显示图片。 YourListView.Items.Add(string,Int32)。

We're here to help people learn how to program, as well as with application design issues, and to assist people when they are stuck writing code. With rare exceptions, no one here is going to send you the code.

It's important you take the initiative and start writing code. But, if you are not ready for that, the least you can do is search CodeProject for articles that use PictureBox, and ImageList, and that show you how to create thumbnails.

Start by studying the WinForm PictureBox Control. Put a PictureBox on a Form, and write the code to load an Image into it.

Learn how to create a ThumbNail of an Image read from a File.

Put a ListView on a Form, and set its 'View property to 'LargeIcon, or 'SmallIcon.

Put an ImageList Component on the Form, and add Images to it.

Set either the 'LargeImageList or 'SmallImageList properties of the ListView to the ImageList depending on whether you specified the 'View property as 'LargeIcon or 'SmallIcon.

Add Items to the Listview using the ListViewItem constructor that takes a string, and an index into the ImageList to display the Image. YourListView.Items.Add(string, Int32).


最好的方法是在Application Data文件夹下创建一个可以检查的文件夹,用户(或你的应用程序)可以添加图片来。

这可以帮助您找到它:我应该在哪里存储我的数据? [ ^ ] - 您不必使用Guids,您可以使用您的应用程序名称和背景,以便用户更容易找到。



然后,只需加载图像(使用 Image.FromFile [ ^ ]方法)然后自己绘制(好主意)或使用PictureBo x(好主意,但是如果处理大量图像则很差)。
The best way is to create a folder under the Application Data folder that you can check, and the user (or your application) can add images to.
This should help you locate it: Where should I store my data?[^] - you don't have to use Guids, you can use your application name and "Backgrounds" for example to make it easier for the user to find.

Then, just load the images (using the Image.FromFile[^] method) and then paint it yourself (good idea) or use a PictureBox (OK idea, but poor if you deal with lots of images).


这篇关于如何将数据(图像,...)插入Winform应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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