Solved

Setting size of ole font in ActiveX control

Posted on 1997-07-17
4
1,052 Views
Last Modified: 2013-12-02
How to set size of ole font in ActiveX control. When ActiveX control is
inserted in the project ole font wrapper class( COleFont) is created
and it has method SetSize which takes argument size of type OLE currency. I
don't understand what type it is. There is a macro FONTSIZE which converts
from font height to CY but if I provider for instance 8 as a height a get
bold font which is greater then 8.
Please explain to me how to use it and programmatically set size of the
font in ActiveX control.
Thanks.
0
Comment
Question by:galkin
  • 2
4 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302619
There is a pretty good book called Active X inside out by Adam Denning from MS Press. There are about 200 pages dedicated to fonts on Active X controls and a pretty lucid explaination on the same. Check it out....
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1302620
You should use IFontDispatch interface to set font size. There is a good artical about how to set font size in VC++ 5.0 help called "ActiveX Controls: Using Fonts in an ActiveX Control". If you can not find it let me know and I can email it to you.
0
 
LVL 7

Author Comment

by:galkin
ID: 1302621
IFontDispatch is IDispattch interface allowing set font size ONLY through SetSize font of COleFont wrapper class. This function takes one parameter namelyCOleCurrency. The question is how to properly convert fon size in pixels in OLE currency value. I have not found yet better solution.
0
 
LVL 8

Accepted Solution

by:
gelbert earned 50 total points
ID: 1302622
Here is sample:

static const FONTDESC _fontdescHeading =
  { sizeof(FONTDESC), OLESTR("MS Sans Serif"), FONTSIZE( 12 ), FW_BOLD,
     ANSI_CHARSET, FALSE, FALSE, FALSE };

it is from the artical "OLE Controls: Using Fonts in an OLE Control" from MSDN.

If you want to use IDispatch based interface then you will have to multiply font size value by 10000.

 

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sumDigits challenge 9 170
sum67 challenge 35 107
erros on link  checking 2 78
Sources to create infographic resume 2 17
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question