Available in the LEADTOOLS Imaging toolkit. |
GetPicture and SetPicture example for Visual J++
To use this code, you must first add a PictureBox control to your form, and make it invisible.
// Hide the LEAD control
LEAD1.setVisible( false );
// Assign the picture object to the PictureBox control
pictureBox1.setImage( LEAD1.GetPicture() );
// Give the PictureBox control the same size and position as the LEAD control
pictureBox1.setTop ( LEAD1.getTop() );
pictureBox1.setLeft( LEAD1.getLeft() );
pictureBox1.setHeight( LEAD1.getHeight() );
pictureBox1.setWidth( LEAD1.getWidth() );
// Interrupt with a message.
MessageBox.show( "This is the PictureBox. Click OK for the SetPicture method" );
// Get the picture object back to the LEAD control and repaint it
LEAD1.setAutoSetRects( false ); // Keep the previous display rectangles.
LEAD1.SetPicture( pictureBox1.getImage() ); // Load the bitmap from the PictureBox control.
pictureBox1.setVisible( false ); // Hide the PictureBox control.
LEAD1.setVisible( true ); // Make the LEAD control visible.
LEAD1.ForceRepaint();