2
是否可以在DataGridViewImageColumn的列中顯示多個圖像?我只有1列,需要動態顯示圖像。根據其他條件,該列可以顯示1到3張圖像。在DataGridView圖像列中顯示多個圖像?可能嗎?
是否可以在DataGridViewImageColumn的列中顯示多個圖像?我只有1列,需要動態顯示圖像。根據其他條件,該列可以顯示1到3張圖像。在DataGridView圖像列中顯示多個圖像?可能嗎?
您可以將要顯示的兩幅圖像繪製到第三張新圖像上,然後將其顯示在列中。
事情是這樣的:
Bitmap Image1 = new Bitmap(10, 10); //replace with your first image
Bitmap Image2 = new Bitmap(10, 10); //replace with your second image
Bitmap ImageToDisplayInColumn = new Bitmap(Image1.Width + Image2.Width, Image1.Height);
using (Graphics graphicsObject = Graphics.FromImage(ImageToDisplayInColumn))
{
graphicsObject.DrawImage(Image1, new Point(0, 0));
graphicsObject.DrawImage(Image2, new Point(Image1.Width, 0));
}
有幾篇關於創建自定義DataGridViewColumns的文章。這裏有一個來自CODE magazine。這聽起來像你想寫你自己的代碼來繪製與適當的圖像或圖像列。
+1非常有用鏈接 – Kamil 2013-03-03 17:26:21