This document is archived and information here might be outdated.  Recommended version.


Create Default FontDisp Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Create Default FontDisp Snippet

Generate a default FontDisp object.

[C#]
///<summary>Generate a default FontDisp object.</summary>
/// 
///<returns>An stdole.IFontDisp interface</returns>
///  
///<remarks></remarks>
public stdole.IFontDisp CreateDefaultFontDisp()
{
  stdole.IFontDisp fontDisp=new stdole.StdFontClass() as stdole.IFontDisp; // Dynamic Cast
  fontDisp.Bold=false;
  fontDisp.Name="Arial";
  fontDisp.Italic=false;
  fontDisp.Underline=false;
  fontDisp.Size=16;

  return fontDisp;
}
[Visual Basic .NET]
'''<summary>Generate a default FontDisp object.</summary>
''' 
'''<returns>An stdole.IFontDisp interface</returns>
'''  
'''<remarks></remarks>
Public Function CreateDefaultFontDisp() As stdole.IFontDisp

  Dim fontDisp As stdole.IFontDisp=CType(New stdole.StdFont, stdole.IFontDisp) ' Explicit Cast
  With fontDisp
    .Bold=False
    .Name="Arial"
    .Italic=False
    .Underline=False
    .Size=16
  End With

  Return fontDisp

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • stdole