Solved

Setting size of ole font in ActiveX control

Posted on 1997-07-17
4
1,057 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

729 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