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
{
public Form1()
{
InitializeComponent();
}
//图片的宽和高
private const int PicWidth = 31;
private const int PicHeight = 34;
private const int MapWidth = 19;
private const int MapHeight = 11;
private const int MaxPic = 39;
//本局中图片的数量
private int picnum = 18;
private int multipic = 4; //一张图片重复出来的次数,一定为偶数
int[,] Gmap = new int[MapWidth, MapHeight];//实际的图片矩阵为19*11
Graphics g_g = null;//全局画布
//加载到内存中的图片
Image[] PicImg = new Image[39];
Image[] bombimg = new Image[6];
private void Form1_Paint(object sender, PaintEventArgs e)
{
g_g = this.CreateGraphics();
for (int i = 0; i < MapWidth; i++)
for (int j = 0; j < MapHeight; j++)
Gmap[i, j] = 0;
}
public void GetImg()
{
for (int i = 0; i < 39; i++)
{
ResourceManager rm = new ResourceManager("连连看.PicResource", Assembly.GetExecutingAssembly());
PicImg[i] = (Image)rm.GetObject(i.ToString());
}
g_g.DrawImage(PicImg[2], new Point(100, 100));
}
}
}
如上代码 图片资源存在 却没有在Point(100, 100) 显示出来 为什么??
------解决方案--------------------------------------------------------
GetImg没有调用啊.
------解决方案--------------------------------------------------------
namespace 连连看
-------------------
汉语编程?