LEADTOOLS Vector C++ Class Library Help > LEADTOOLS Vector Features > LVectorWindow > Using LVectorWindow as a Control |
To use the LVectorWindow (or any derived) class as a windowed control in your application, you must create an LVectorWindow object as a child window of some parent window, using LVectorWindow::CreateWnd. After that, the parent window will receive control notification messages that you can process if you like.
This example was done using MFC, so your code may look different if you use some other foundation class library.
For a complete example, please refer to the C++ Class Library Vector Demo. In the file VecView.cpp, search for this code, and follow the instructions for modifying the demo to work with the LVectorWindow as either a Window or a Control.
There are two way to use LEAD controls :
// 1.As a control:
// Enable A and Disable B
// 2.As a Window :
// Enable B and Disable As
The following is a short example of getting started using LVectorWindow as a Control. This example was done using MFC, so your code may look different if you use some other foundation class library.
// Do not forget to load the libraries in application's initialization code:
// LBase::LoadLibraries (LT_ALL_LEADLIB);
// Declare an LVectorWindow object, or a pointer to an LVectorWindow object
// In the Vector Demo, this in the Document Class
public:
LVectorWindow *m_pVectorWindow;
//If working with a pointer to an LVectorWindow object, allocate the object
//In the Vector Demo, this is in the Document class constructor
m_pVectorWindow = new LVectorWindow;
//Create the LVectorWindow control using CreateWnd
//In the vector Demo, this is done in the View Class, in the OnCreate() function
//The size of the control is 300x200. You can change this at runtime by using
// FitToParent() or
// Move()
hWnd = GetDocument()->m_pVectorWindow->CreateWnd( m_hWnd,0,
WS_VISIBLE|L_BS_CENTER|
L_BS_PROCESSKEYBOARD,
0,0,300,200);
//Add code to load a file.
//In the Vector Demo, this is in the Document class, in the OnOpenDocument() function
m_pVectorWindow->Load(szTemp);