views:

139

answers:

2

I display some objects that have thumbnails in two ways: one in a DataGridView, and one in a custom control.

In the DataGridView, the thumbnail is displayed in a DataGridViewImageCell. If the thumbnail is missing, the cell displays an error icon.

I want to show that icon in my custom control, too. How do I get hold of it? Preferably without pinvoke, but beggars can't be choosers.

+1  A: 

I think, this icon is available in "%visual_studio_directory"\Common7\VS2005ImageLibrary" directory.

TcKs
I don't see it - could you be more specific?
Simon
C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\VS2005ImageLibrary\VS2005ImageLibrary\icons\WinXP\error.ico...........\warning.ico
TcKs
+2  A: 

I'd recommend turning this problem on its head: make sure the grid never displays the error icon. You should be able to do this by catching the cell data display event. If the image is missing, display an image from your resource segment (and use the same image in the custom control, obviously).

The problem with attempting to match the grid's built-in error image is that if the image gets changed in a future version, you'll have to modify your application.

Craig Eddy