高手来~

gibby 2008-09-09 04:55:32
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Media;
using System.Runtime.InteropServices;
using System.Threading;
using System.Resources;
using System.Reflection;

namespace 连连看
{
public partial class Form1 : Form
{

Image[] PicImg = new Image[39];
public Form1()
{
InitializeComponent();
GetImg();
}

public void GetImg()
{
Graphics g = this.CreateGraphics();
g.DrawLine(new Pen(new SolidBrush(Color.DeepSkyBlue), 5), 0, 11 * 34 + 5, 19 * 34, 11 * 34 + 5);

for (int i = 0; i < 39; i++)
{
ResourceManager rm = new ResourceManager("连连看.PicResource", Assembly.GetExecutingAssembly());
PicImg[i] = (Image)rm.GetObject(i.ToString());
}
g.DrawImage(newImage, new Point(100, 300));
}
}
}


如上代码 图片资源存在 却没有在Point(100, 100) 显示出来 为什么??
...全文
90 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wdgphc 2008-09-09
  • 打赏
  • 举报
回复
g.DrawImage(newImage, new Point(100, 300));
这个变量你是如何定义/赋值的?
  • 打赏
  • 举报
回复
private void Form1_Paint( object sender, PaintEventArgs e )
{
GetImg();
}
执行顺序的问题啊。
brallow 2008-09-09
  • 打赏
  • 举报
回复
1:你说的图片资源存在是什么意思?
我想你需要做如下的检查:
*:rm对象是否为空?
*:在你赋值给PicImg[i],请检查rm.GetObject(i.ToString())返回的结果是否为null?
2:我不记得对resourceManager中资源名称引用的格式了,如果你的名称不正确,可能导致rm返回的值为null,我查查再回复下。

111,125

社区成员

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

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

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