Forum Discussion

Jimbo's avatar
Jimbo
Occasional Contributor
8 years ago
Solved

Which icon is displayed in datagridview?

Okay, so I have an application which displays various icons depending on the state of the entries in a .NET "DataGridView". I need to verify that the correct icons are displayed.   How would one go...
  • Colin_McCrae's avatar
    Colin_McCrae
    8 years ago

    OK.

     

    I think I have a viable property (Field) you can use.

     

    The grid is zero indexed (you show Row 1, Row 2, Row 3 etc in your sample .... they are actually Row 0, Row 1, Row 2) which may confuse some.

     

    But it looks like the - ["nativeImage"] - value (which is a "Field" rather than a "Property") contains a number directly linked to the image displayed.

     

    Full ref to it being:

     

    NameMapping["Sys"]["Process"]("IconDatagrid")["WinFormsObject"]("FormMain")["WinFormsObject"]("dataGridViewExample")["wValue"](<ROW NUMBER>, "Pick this")["nativeImage"]

     

    Which returns:

     

    75768992 row 0
    75763416 row 1
    75768992 row 2
    75768992 row 3
    75763416 row 4
    75763416 row 5
    75768992 row 6

    and so on ....

     

    ... which ties in perfectly with how the images vary.

     

    So 75768992 is your white image. And 75763416 is your red one.

     

    A lookup table for them would seem sensible to make things a little more meaningful.