C# winform 如何把bin目录下建立Image文件夹的图片读取到picturebox中

C#winform如何把bin目录下建立Image文件夹的图片读取到picturebox中,在picturebox中一张一张的显示,间隔时间1s... C# winform 如何把bin目录下建立Image文件夹的图片读取到picturebox中,在picturebox中一张一张的显示,间隔时间1s 展开
 我来答
dengqin1986
2010-08-13
知道答主
回答量:9
采纳率:0%
帮助的人:0
展开全部
#region 绑定ImageList图片
ImageList imalist = new ImageList();
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TreeView));
imalist = new ImageList();
//imalist.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imalist.ImageStream")));
imalist.TransparentColor = System.Drawing.Color.Transparent;
tv_UserGroup.ImageList = imalist;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//当前程序路径
string imgPaths = System.Windows.Forms.Application.StartupPath.Replace("\\bin", "").Replace("\\Debug", "");
List<string> list = new List<string>();
list.Add("\\ResourceMap\\PeopleAndBook.JPG");
list.Add("\\ResourceMap\\computer.JPG");
list.Add("\\ResourceMap\\computers.JPG");
list.Add("\\ResourceMap\\key.JPG");
list.Add("\\ResourceMap\\Peoples.JPG");
//ImageList序号
int imgIndex = 0;
//image物理名
string imgName;
foreach (string imgPath in list)
{
if (imgPath != string.Empty)
{
imgName = imgPath.Substring(imgPath.LastIndexOf("\\") + 1, imgPath.Length - imgPath.LastIndexOf("\\") - 1);
System.Drawing.Image myImage = System.Drawing.Image.FromFile(imgPaths + imgPath);
imalist.Images.Add(myImage);
imalist.Images.SetKeyName(imgIndex, imgName);
imgIndex++;
}
}
#endregion
这个是把图片绑定到imagelist上,然后用timer控件刷新就可以啦
wu_xiaolin2009
2010-08-13 · TA获得超过632个赞
知道小有建树答主
回答量:378
采纳率:0%
帮助的人:296万
展开全部
添加一个Timer,设置Timer启动间隔为1S,在OnTimer事件函数中读取图片并在picturebox中显示
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
rover1367
2010-08-13 · TA获得超过253个赞
知道小有建树答主
回答量:251
采纳率:0%
帮助的人:157万
展开全部
设个1秒的timer..去给你的控件赋值即可
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
cfasus
2010-08-14 · TA获得超过705个赞
知道小有建树答主
回答量:876
采纳率:33%
帮助的人:372万
展开全部
做动画
哈哈
别急
慢慢来
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式