Available in the LEADTOOLS Imaging toolkit. |
Using the Magnifying Glass (Visual C++ 5.0 or later)
Take the following steps to enable the generation of the MagGlass event.
Create a new MFC Single based Dialog application.
Right-Click on the Dialog and click on "Insert ActiveX.."
Add LEAD Main ActiveX control on the Form.
Add 3 buttons on the form. Set Button1 caption to "Load Image" Set Button2 caption to "Start MagGlass" and Button3 caption to "Stop MagGlass"
Add a member variable to the LEAD Main ActiveX and call it "m_Lead1"
Declare the following two global variables at the beginning of the project:
int nRet;
bool bMagGlass;
Add the following code to the OnButton1():
//LoadImage
bMagGlass = false;
m_Lead1.SetAutoPan(false);
m_Lead1.SetAppearance(0);
m_Lead1.SetBorderStyle(1);
m_Lead1.SetBackColor(RGB(255, 255, 125));
m_Lead1.SetPaintDither(1);
m_Lead1.SetPaintPalette(0);
m_Lead1.SetAutoRepaint(true);
m_Lead1.SetAutoSize(false);
m_Lead1.SetAutoSetRects(true);
m_Lead1.SetPaintSizeMode(3);
m_Lead1.Load("C:\\test.tif",1,1,1);
Add this code in OnButton2():
long hRgn;
float xCenter;
float yCenter;
m_Lead1.SetRgnFrameType(0);
hRgn = m_Lead1.GetRgnHandle();
xCenter = m_Lead1.GetRgnLeft() + m_Lead1.GetRgnWidth()/ 2;
yCenter = m_Lead1.GetRgnTop() + m_Lead1.GetRgnHeight()/ 2;
m_Lead1.SetRgnHandle(hRgn, xCenter - m_Lead1.GetBitmapWidth()/ 2, yCenter - m_Lead1.GetBitmapHeight()/ 2, 1);
m_Lead1.DeleteRgnHandle(hRgn);
nRet = m_Lead1.StartMagGlass(150,100,200, RGB(255, 255, 225), m_Lead1.GetBackColor(), false, 1, true, 1, true, true);
bMagGlass = true;
Add this code in OnButton3():
if(m_Lead1.GetBitmap()!= 0)
{
nRet = m_Lead1.StopMagGlass();
if (nRet = 0)
bMagGlass = false;
}