C#位图行和列帮助

C#位图行和列帮助,c#,bitmap,grid,location,image,C#,Bitmap,Grid,Location,Image,我想有一个位图或图片(不确定)的行和列,这样说,如果我设置了10行和10列,那么它必须建立一个类(不确定),其中的行和列的宽度为10,高度为10,这样我就可以访问任何位置,并在该框/位置的任何位置设置图像。我该怎么做? 提前多谢 好像我通过了 private printGrid(int x, int y) { // this function will print x rows and y columns such that each box's width is 10 px and hei

我想有一个位图或图片(不确定)的行和列,这样说,如果我设置了10行和10列,那么它必须建立一个类(不确定),其中的行和列的宽度为10,高度为10,这样我就可以访问任何位置,并在该框/位置的任何位置设置图像。我该怎么做? 提前多谢

好像我通过了

private printGrid(int x, int y) {
  // this function will print x rows and y columns such that each box's width is 10 px and height is 10px and also a way to modify any (x,y) in this to hold an image of 5px at later time
}

private insertImage(Image img, int x, int y) {
  // inserts the image in the xth row and yth column
}

如何使用C#?

将图像分割为每个10x10的框,然后将另一个5x5图像插入这些框中,并将更改反映在原始图像上?您可以这样做:

void AddBox(int row, int col, Image mainImage, Image otherImage) {
     using(Graphics g = Graphics.FromImage(mainImage)) {
          g.DrawImage(otherImage, col * 10, row * 10);
     }
}

请你换个说法好吗?我不明白你想做什么…我想要的是一张动态制作的图片,它被分成行和列,每个框的宽度为10px,高度为10px,我应该能够将5px的图像动态插入到任何框中,用C#你的问题还不是很清楚,但似乎你需要的只是一个图像网格。是这样吗?你需要将这些图像可视化吗?它是WinForms应用程序吗?WPF?银灯?Asp.Net?如果这是一个可视化问题,仅仅说你正在使用C#通常是不够的