Barcode Fonts, Components, ActiveX and .NET Windows Forms Controls, Java Servlets, 
DLLs and Barcode Scanners., Inc., Computers Hardware, Software & Services, Tampa, FL View your cart in the IDAutomation Store    

CreatePointFont function to dynamically create barcodes within a C++ application?


Can the CreatePointFont function be used to dynamically create instances of fonts within a C++ application? Yes it can. The following is an example of using the CreatePointFont function. Ensure that the variables are scoped properly to avoid any problems with the fonts being sized correctly through each pass of this routine.

private void CreateAFont() {
//Create a font object in case  we want to test with a different kind of font
CFont pageNumFont; //The initial point size times a "magnifier" variable.
pageNumFont.CreatePointFont(200 * m_Flags.m_Zoom, "Arial Bold", pCDC);
//Here is the data that is going to be drawn on the screen
CString pageStyleNum = "898798789:;
//Create a font object
CFont OCRAfont;
long lPointSize = 100;

//Create a 10 Point font out of the IDAutomationOCRa font using the device context
//of the screen. The parameters are the point size of the font (multiplied //by a factor of 10), the name of the font, and a pointer to the device //context that the font will be drawn on
OCRAfont.CreatePointFont(lPointSize , "Advocra", this->GetDC());
//Here is the bounding rectangle for the text that we are going to draw
CRect OCRArect(50, 100, 600, 200);
//Select the font needed to draw with
pCDC->SelectObject(&OCRAfont); pCDC->DrawText(pageStyleNum, OCRArect, DT_SINGLELINE | DT_LEFT | DT_NOCLIP); }
 ©Copyright 2018, All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us

Training Videos on YouTube  Join us on Google Plus  Join us on LinkedIn  Follow us on Twitter  Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.