图像显示不出来

lizhengqin 2007-06-14 10:12:09
private void gdipic_Load(object sender, System.EventArgs e)
{
ListPicture();
}

void ListPicture()
{
Bitmap bm=new Bitmap(@"F:\下载\myWindowsForm\WindowsForm\WindowsForm\bin\Debug\images\out2188_L.jpg");

Graphics g=this.CreateGraphics();

g.DrawImage(bm,1,1);
}

环境是.net 1.1 图片在页面上显示不出来
...全文
169 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lizhengqin 2007-06-14
  • 打赏
  • 举报
回复
谢谢二位,我改用按钮触发它,就可以显示图片了
北京的雾霾天 2007-06-14
  • 打赏
  • 举报
回复
在Paint事件里调用ListPicture函数就可以了.



因为在Load事件里窗体还未显示,等它显示出来时又会被默认的Paint事件所重绘掉了.
time_is_life 2007-06-14
  • 打赏
  • 举报
回复
// Create image.
Image newImage = Image.FromFile("SampImag.jpg");

// Create coordinates for upper-left corner of image.
int x = 100;
int y = 100;

// Draw image to screen.
e.Graphics.DrawImage(newImage, x, y);

111,120

社区成员

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

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

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