DrawShape example for Visual J++

This example demonstrates most of the three-dimensional shape properties as it draws a rectangle on the current bitmap. For example purposes, both inner and outer bands are turned on. However, normal three-dimensional effects use inner bands or outer bands, but not both.

LEAD1.setAutoRepaint( false );

// Load an image for the main control
LEAD1.Load( "c:\\lead\\images\\image1.cmp", (short) 0, (short) 0, (short) 1 );

// Load an image for the background of the shape
LEAD2.Load( "c:\\lead\\images\\ulay1.bmp", (short) 0, (short) 0, (short) 1 );

// Shape background
LEAD1.setShapeBackgroundStyle( (short) 
LTOCXU.EfxBackStyleConstants.EFX_BACKSTYLE_TILED_IMAGE );
LEAD1.setBackgroundImageTop( 0 );
LEAD1.setBackgroundImageLeft( 0 );
LEAD1.setBackgroundImageWidth( LEAD2.getBitmapWidth() );
LEAD1.setBackgroundImageHeight( LEAD2.getBitmapHeight() );

// Shape location
LEAD1.setShapeTop( 50 );
LEAD1.setShapeLeft( 50 );
LEAD1.setShapeWidth( LEAD1.getDstWidth() - 50 );
LEAD1.setShapeHeight( LEAD1.getDstHeight() - 50 );

// Shape border
LEAD1.setShapeBorderColor( new Color( 255, 0, 0 ) );
LEAD1.setShapeBorderStyle( (short) LTOCXU.EfxBorderStyleConstants.EFX_BORDERSTYLE_SOLID );
LEAD1.setShapeBorderThickness( 10 );
LEAD1.setShapeInnerBandHiliteColor( new Color( 255, 255, 255 ) );
LEAD1.setShapeInnerBandShadowColor( new Color( 0 ) );
LEAD1.setShapeInnerBandStyle( (short) 
LTOCXU.EfxFrameInnerStyleConstants.EFX_INNERSTYLE_RAISED );
LEAD1.setShapeInnerBandThickness( 2 );

LEAD1.setShapeOuterBandHiliteColor( new Color( 0, 255, 0 ) );
LEAD1.setShapeOuterBandShadowColor( new Color( 128, 128, 128 ) );
LEAD1.setShapeOuterBandStyle( (short) 
LTOCXU.EfxFrameOuterStyleConstants.EFX_OUTERSTYLE_RAISED );
LEAD1.setShapeOuterBandThickness( 2 );

// Make the shape a permanent part of the bitmap
LEAD1.setDrawPersistence( true );

// Draw the shape
LEAD1.DrawShape( (short) LTOCXU.EfxShapeConstants.EFX_SHAPE_RECTANGLE, LEAD2.getBitmap() );

// Repaint
LEAD1.setAutoRepaint( true );