ComponentOne VSFlexGrid 8.0
Handling Pictures

The VJ++ wrappers generated for picture properties work correctly, and you can use the setCellPicture and getCellPicture methods normally. However, the wrappers fail when the picture is contained in a Variant, which prevents you from using the SetCell method to set cell pictures directly.

There is an easy workaround for this. By inspecting the wrapper code, you can see that J++ converts its native image type to an IPictureDisp interface with a call to the com.ms.wfc.ui.AxHost.getIPictureDispFromPicture(img) support function.

By using this in your calls to setCell, you can set pictures with no problems. For example:

Example Title
Copy Code
  // get Image object

  Image img = pictureBox1.getImage();

  // assign to current cell

  VSFlexGrid1.setCellPicture(img);

  // assign to a range

  VSFlexGrid1.setCell(3, new Variant(3), new Variant(3),

     new Variant(4), new Variant(4),

     new Variant(com.ms.wfc.ui.AxHost.getIPictureDispFromPicture(img)));

  // this does *not* work

  //VSFlexGrid1.setCell(3, new Variant(3), new Variant(3),

  //    new Variant(4), new Variant(4),new Variant(img));

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback