IFontDisp and StdFontClass

3874
3
Jump to solution
07-12-2012 08:40 AM
MarkParr
New Contributor
I notice that several of the ArcGIS examples reference code like:

stdole.IFontDisp font = new stdole.StdFontClass() as stdole.IFontDisp;
font.Name = "Arial";
font.Bold = true;


However whenever I try to compile this I get the error:

Error 7 The type 'stdole.StdFontClass' has no constructors defined


What's missing?
0 Kudos
1 Solution

Accepted Solutions
RichWawrzonek
Occasional Contributor
This function works for me:

private static stdole.IFontDisp GetFont(string fontName)         {             stdole.IFontDisp dispFont = (stdole.IFontDisp)new stdole.StdFont();             dispFont.Name = fontName;             return dispFont;         }


Be sure to add a reference to stdole.dll to your project.

View solution in original post

0 Kudos
3 Replies
MarkParr
New Contributor
Anyone else ever see/experience this?
0 Kudos
RichWawrzonek
Occasional Contributor
This function works for me:

private static stdole.IFontDisp GetFont(string fontName)         {             stdole.IFontDisp dispFont = (stdole.IFontDisp)new stdole.StdFont();             dispFont.Name = fontName;             return dispFont;         }


Be sure to add a reference to stdole.dll to your project.
0 Kudos
MarkParr
New Contributor
This function works for me:

private static stdole.IFontDisp GetFont(string fontName)
        {
            stdole.IFontDisp dispFont = (stdole.IFontDisp)new stdole.StdFont();
            dispFont.Name = fontName;
            return dispFont;
        }


Be sure to add a reference to stdole.dll to your project.



Thanks - that pointed me in the right direction.

I had tried your format w/ the same error but noticed that you were using StdFont() and not StdFontClass().  Once I changed my code to StdFont() things compiled.  Went back and looked and the code that I "borrowed" from was using StdFontClass() though.
0 Kudos