C#。pictureBox控件的ImageLocation的使用问题!【速度结贴】

新尙木头 2011-01-20 08:59:34
我做了个项目。。然后有个放Image的文件夹。。
我想问下。Imagelocation这个属性,只能设置绝对路径吗?
相对路径的话。怎么用?
我现在是这么写的。可以实现:

picMin.ImageLocation=@"E:\MyProject\C#\MyQQ\images\Button_min_highlightBackground.bmp";

但是我要用相对路径啊!
在线等答案。。
速度结贴!!!
...全文
1535 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
海涵德 2011-01-21
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xiaosei 的回复:]

[/Quote]
当然自己要在images文件夹中有:
1.jpg,2.jpg,3.jpg了。
新尙木头 2011-01-21
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 wuyq11 的回复:]
pictureBox1.ImageLocation = "http://c.csdn.net/a.gif";
private IList<Image> lst= new List<Image>();
private int index= 0;
private Timer timer1 = new Timer();
private void Form1_Load(object s……
[/Quote]
不好意思哈。。
我不用imagelist控件
新尙木头 2011-01-20
  • 打赏
  • 举报
回复
新尙木头 2011-01-20
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 madaming 的回复:]
C# code
form_load()
{
Image img1=Image.FromFile(@"\images\Button_min_highlightBackground1.bmp");
Image img2=Image.FromFile(@"\images\Button_min_highlightBackground2.bmp");
Image img3=……
[/Quote]
额。。我想请问。那个images文件夹。该放哪里啊?
wuyq11 2011-01-20
  • 打赏
  • 举报
回复
pictureBox1.ImageLocation = "http://c.csdn.net/a.gif";
private IList<Image> lst= new List<Image>();
private int index= 0;
private Timer timer1 = new Timer();
private void Form1_Load(object sender, EventArgs e)
{
lst.Add(Image.FromFile(@"C:\1.jpg"));
lst.Add(Image.FromFile(@"C:\2.gif"));
lst.Add(Image.FromFile(@"C:\1.gif"));
timer1.Interval = 1000;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Enabled = true;

}
void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Image = m_ListImage[index];
index++;
if (index> lst.Count-1)index= 0;
}
海涵德 2011-01-20
  • 打赏
  • 举报
回复
form_load()
{
Image img1=Image.FromFile(@"\images\Button_min_highlightBackground1.bmp");
Image img2=Image.FromFile(@"\images\Button_min_highlightBackground2.bmp");
Image img3=Image.FromFile(@"\images\Button_min_highlightBackground3.bmp");

picturebox1.image=img1;
}
picturebox1_mouseover()
{
picturebox1.image=img2;
picturebox1.refresh();
}
picturebox1_mousedown()
{
picturebox1.image=img3;
picturebox1.refresh();
}
海涵德 2011-01-20
  • 打赏
  • 举报
回复
form_load()
{
Image img1=Image.FromFile(@"\images\Button_min_highlightBackground1.bmp");
Image img2=Image.FromFile(@"\images\Button_min_highlightBackground2.bmp");
Image img3=Image.FromFile(@"\images\Button_min_highlightBackground3.bmp");

picturebox1.image=img1;
}
picturebox1_mouseover()
{
picturebox1.image=img2;
}
picturebox1_mousedown()
{
picturebox1.image=img3;
}
新尙木头 2011-01-20
  • 打赏
  • 举报
回复
1楼的不能用!
新尙木头 2011-01-20
  • 打赏
  • 举报
回复
还有个问题。

pictureBox可以这么用吗?
我有个图片。
晕死。我不会上传。。

就是比如说:【1】【2】【3】
这样的图片。
我要刚开始显示【1】
鼠标悬浮的时候显示【2】
按下的时候显示【3】

继续在线等答案!
海涵德 2011-01-20
  • 打赏
  • 举报
回复
picMin.ImageLocation=@"\images\Button_min_highlightBackground.bmp";

111,101

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧