Visual Basic Developers Use Teigha
April 06, 2017
Thanks to Teigha.NET, C++ developers are not the only CAD developers using Teigha. And C# is not the only language that can be used to design a Teigha.NET based application. Visual Basic can be used as well.
Earlier versions of Teigha included only C# sample applications in the Teigha.NET archive, but now a Visual Basic sample application is included: VBDwgAppSwigMgd.
Currently it implements two main features:
- Render a loaded .dwg file.
- PDF export of a loaded .dwg file.
Rendering was implemented by adding a new custom control class: DisplayControl. DisplayControl operates with the following entities:
- TDDatabase — Loaded file database
- m_pDevice — Drawing device
- Context — Device context
Those entities are used in the following methods:
- overridden methods of any control:
- other methods:
Exporting to a .pdf file is implemented in the ExportToPdf_Click handler. Two auxiliary dialog forms are used to set PDF export parameters:
- PDFParams — Main PDF parameters
- CustomPDFProperties — Auxiliary PDF parameters
If the PDFParams dialog is closed with OK as the result, the fields are set for the PDFExportParams entity, and they are used in calling of the exportPDF method performed for OdPdfExport.