Available in the LEADTOOLS Imaging toolkit. |
DrawText example for C++ 4.0 and later
This example demonstrates most of the properties of a three-dimensional text object as it draws rotated text on the current bitmap.
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 foreground of the text
m_Lead2.Load("ulay1.bmp", 0, 0, 1);
// text location
m_Lead1.SetTextTop(50);
m_Lead1.SetTextLeft(50);
m_Lead1.SetTextWidth(m_Lead1.GetDstWidth() - 50);
m_Lead1.SetTextHeight(m_Lead1.GetDstHeight() - 50);
// The foreground image needs to be the correct size.
m_Lead2.Size(m_Lead1.GetTextWidth(), m_Lead1.GetTextHeight(), 0);
// Text alignment and angle
m_Lead1.SetTextAlign(EFX_TEXTALIGN_HCENTER_VCENTER);
m_Lead1.SetTextAngle(450); // 45 degrees
// Text highlight color and style
m_Lead1.SetTextHiliteColor(RGB(255, 255, 255));
m_Lead1.SetTextStyle(EFX_TEXTSTYLE_DROPSHADOW);
// Text drop shadow
m_Lead1.SetShadowColor(RGB(0, 0, 0));
m_Lead1.SetShadowXDepth(5);
m_Lead1.SetShadowYDepth(5);
// Make the text a permanent part of the bitmap
m_Lead1.SetDrawPersistence(TRUE);
// Draw the text
m_Lead1.DrawText("LEADTOOLS", m_Lead2.GetBitmap());
m_Lead1.ForceRepaint();