Available in the LEADTOOLS Imaging toolkit. |
DrawShape example for C++ 4.0 and later
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.
m_Lead1.SetAutoRepaint(FALSE);
// Load an image for the main control
m_Lead1.Load("c:\\lead\\images\\image1.cmp", 0, 0, 1);
// Load an image for the background of the shape
m_Lead2.Load("ulay1.bmp", 0, 0, 1);
// Shape background
m_Lead1.SetShapeBackgroundStyle(EFX_BACKSTYLE_TILED_IMAGE);
m_Lead1.SetBackgroundImageTop(0);
m_Lead1.SetBackgroundImageLeft(0);
m_Lead1.SetBackgroundImageWidth(m_Lead2.GetBitmapWidth());
m_Lead1.SetBackgroundImageHeight(m_Lead2.GetBitmapHeight());
// Shape location
m_Lead1.SetShapeTop(50);
m_Lead1.SetShapeLeft(50);
m_Lead1.SetShapeWidth(m_Lead1.GetDstWidth() - 50);
m_Lead1.SetShapeHeight(m_Lead1.GetDstHeight() - 50);
// Shape border
m_Lead1.SetShapeBorderColor(RGB(255, 0, 0));
m_Lead1.SetShapeBorderStyle(EFX_BORDERSTYLE_SOLID);
m_Lead1.SetShapeBorderThickness(10);
m_Lead1.SetShapeInnerBandHiliteColor(RGB(255, 255, 255));
m_Lead1.SetShapeInnerBandShadowColor(0);
m_Lead1.SetShapeInnerBandStyle(EFX_INNERSTYLE_RAISED);
m_Lead1.SetShapeInnerBandThickness(2);
m_Lead1.SetShapeOuterBandHiliteColor(RGB(0, 255, 0));
m_Lead1.SetShapeOuterBandShadowColor(RGB(128, 128, 128));
m_Lead1.SetShapeOuterBandStyle(EFX_OUTERSTYLE_RAISED);
m_Lead1.SetShapeOuterBandThickness(2);
// Make the shape a permanent part of the bitmap
m_Lead1.SetDrawPersistence(TRUE);
// Draw the shape
m_Lead1.DrawShape(EFX_SHAPE_RECTANGLE, m_Lead2.GetBitmap());
// Repaint
m_Lead1.SetAutoRepaint(TRUE);