18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

.NET APPLICATION PROGRAMMING INTERFACE<br />

MxCommands.Register and MxCommands.Unregister are used instead of<br />

Microsoft.Win32.Registry.ClassesRoot.CreateSubKey and<br />

Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey.<br />

[VB.NET]<br />

Public NotInheritable Class PanTool<br />

Inherits BaseTool<br />

_<br />

Public Shared Sub Reg(ByVal regKey As [String])<br />

MxCommands.Register(regKey)<br />

End<br />

_<br />

Public Shared Sub Unreg(ByVal regKey As [String])<br />

MxCommands.Unregister(regKey)<br />

End Sub<br />

[C#]<br />

public sealed class PanTool : BaseTool<br />

{<br />

[ComRegisterFunction()]<br />

static void Reg(string regKey)<br />

{<br />

MxCommands.Register(regKey);<br />

}<br />

[ComUnregisterFunction()]<br />

static void Unreg(string regKey)<br />

{<br />

MxCommands.Unregister(regKey);<br />

}<br />

Working with OLE StdFont and StdPicture classes<br />

Some ArcObjects libraries make use of classes and interfaces defined within the<br />

standard OLE libraries from Microsoft. To use these members within .NET, you<br />

should add to your project a reference to the Stdole.dll primary interop assembly,<br />

which is included as part of the .NET support during an <strong>ArcGIS</strong> installation.<br />

This PIA allows you to define StdFont and StdPicture classes, for example:<br />

[C#]<br />

stdole.IFontDisp fnt = (stdole.IFontDisp) new stdole.StdFontClass();<br />

fnt.Name = "Arial";<br />

fnt.Size = 20.0F;<br />

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

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

textSym.Font = fnt;<br />

[Visual Basic .NET]<br />

Dim fnt As stdole.IFontDisp = New stdole.StdFontClass()<br />

fnt.Name = "Arial"<br />

172 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!