DrawShape example for Visual Basic

Note: Also works with Access 95 and 97.

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.AutoRepaint = False

'Load an image for the main control
Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1

'Load an image for the background of the shape
Lead2.Load "ulay1.bmp", 0, 0, 1

'Shape background
Lead1.ShapeBackgroundStyle = EFX_BACKSTYLE_TILED_IMAGE
Lead1.BackgroundImageTop = 0
Lead1.BackgroundImageLeft = 0
Lead1.BackgroundImageWidth = Lead2.BitmapWidth
Lead1.BackgroundImageHeight = Lead2.BitmapHeight

'Shape location
Lead1.ShapeTop = 50
Lead1.ShapeLeft = 50
Lead1.ShapeWidth = Lead1.DstWidth - 50
Lead1.ShapeHeight = Lead1.DstHeight - 50

'Shape border
Lead1.ShapeBorderColor = RGB(255, 0, 0)
Lead1.ShapeBorderStyle = EFX_BORDERSTYLE_SOLID
Lead1.ShapeBorderThickness = 10

Lead1.ShapeInnerBandHiliteColor = RGB(255, 255, 255)
Lead1.ShapeInnerBandShadowColor = 0
Lead1.ShapeInnerBandStyle = EFX_INNERSTYLE_RAISED
Lead1.ShapeInnerBandThickness = 2

Lead1.ShapeOuterBandHiliteColor = RGB(0, 255, 0)
Lead1.ShapeOuterBandShadowColor = RGB(128, 128, 128)
Lead1.ShapeOuterBandStyle = EFX_OUTERSTYLE_RAISED
Lead1.ShapeOuterBandThickness = 2

'Make the shape a permanent part of the bitmap
Lead1.DrawPersistence = True

'Draw the shape
Lead1.DrawShape EFX_SHAPE_RECTANGLE, Lead2.Bitmap

'Repaint
Lead1.AutoRepaint = True