18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

.NET APPLICATION PROGRAMMING INTERFACE<br />

fnt.Size = 20.0<br />

Dim textSym As ESRI.<strong>ArcGIS</strong>.Display.TextSymbol = New<br />

ESRI.<strong>ArcGIS</strong>.Display.TextSymbolClass()<br />

textSym.Font = fnt<br />

Sometimes, however, you may have an existing .NET Font, Bitmap, or Icon class<br />

that you wish to convert to use as a Font or Picture in an ESRI method. The<br />

ESRI.<strong>ArcGIS</strong>.Utility.COMSupport namespace, which is part of the<br />

ESRI.<strong>ArcGIS</strong>.Utility.dll assembly, provides the OLE class, which may help you to<br />

perform such conversions.<br />

Note that these members depend on the System.Windows.Forms.AxHost class<br />

and as such are only suitable for use within a project that has a reference to the<br />

System.Windows.Forms.dll assembly.<br />

Below you can find the syntax information for the members of the<br />

ESRI.<strong>ArcGIS</strong>.Utility.COMSupport.OLE class—these are static (shared in<br />

VB.NET) members and, therefore, can be called without the need to instantiate<br />

the OLE class.<br />

GetIFontDispFromFont: This method can be used to convert an existing .NET<br />

System.Drawing.Font object into an Stdole.StdFont object.<br />

[C#]<br />

public static object GetIFontDispFromFont (System.Drawing.Font font)<br />

[Visual Basic .NET]<br />

Public Shared GetIFontDispFromFont (ByVal font As System.Drawing.Font) As<br />

Object<br />

GetIPictureDispFromBitmap: This method can be used to convert an existing<br />

.NET System.Drawing.Bitmap object into an Stdole.StdPicture object.<br />

[C#]<br />

public static object GetIPictureDispFromBitmap (System.Drawing.Bitmap bitmap)<br />

[Visual Basic .NET]<br />

Public Shared GetIPictureDispFromBitmap (ByVal bitmap As<br />

System.Drawing.Bitmap) As Object<br />

GetIPictureDispFromIcon: This method can be used to convert an existing<br />

.NET System.Drawing.Icon object into an Stdole.StdPicture object.<br />

[C#]<br />

public static object GetIPictureDispFromIcon (System.Drawing.Icon icon)<br />

[Visual Basic .NET]<br />

Public Shared GetIPictureDispFromIcon (ByVal icon As System.Drawing.Icon)<br />

As Object<br />

Below are some examples of using the members of the OLE class.<br />

[C#]<br />

System.Drawing.Font dotNetFont = new System.Drawing.Font("Castellar", 25.0F);<br />

ESRI.<strong>ArcGIS</strong>.Display.ITextSymbol textSym = new<br />

ESRI.<strong>ArcGIS</strong>.Display.TextSymbolClass() as ESRI.<strong>ArcGIS</strong>.Display.ITextSymbol;<br />

textSym.Font =<br />

ESRI.<strong>ArcGIS</strong>.Utility.COMSupport.OLE.GetIFontDispFromFont(dotNetFont) as<br />

stdole.IFontDisp;<br />

Chapter 4 • <strong>Developer</strong> environments • 173

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!