ClipboardService Example
Option Explicit On
Imports PView = Intergraph.GeoMedia.PView
Imports PClient = Intergraph.GeoMedia.PClient
Imports PCSS = Intergraph.GeoMedia.PCSS
Imports GDO = Intergraph.GeoMedia.GDO
Public Class Form1
Dim objLE As PView.LegendEntry, objConn As New PClient.Connection
Dim objOPipe As PClient.OriginatingPipe, objRS As GDO.GRecordset
Dim clp As PClient.ClipboardService
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Set Map View parameters
With GMMapView1
.CoordSystemsMgr = New PCSS.CoordSystemsMgr
.CoordSystemsMgr.CoordSystem.BaseStorageType = PCSS.CSBaseStorageConstants.csbsGeographic
.Legend = New PView.Legend
.BackgroundColor = RGB(255, 255, 255)
End With
' Create connection
With objConn
.Location = "C:\Warehouses\USSampleData.mdb"
.Mode = PClient.ConnectionConstants.gmcModeReadOnly
.Type = "Access.GDatabase"
.Name = "Connect1"
.CoordSystemsMgr = GMMapView1.CoordSystemsMgr
.Connect()
End With
' Create recordset of States
objConn.CreateOriginatingPipe(objOPipe)
objOPipe.Table = "States"
objRS = objOPipe.OutputRecordset
' Create legend entry for states
objLE = CreateObject("Geomedia.LegendEntry")
Dim objstyleservice As New PView.StyleService
Dim objStyle As PView.StyleDefinition = Nothing
objstyleservice.GetStyle("Area Style", objStyle)
' Set legend entry characteristics
With objLE
.GeometryFieldName = "Geometry"
.InputRecordset = objRS
.Style = objStyle
End With
GMMapView1.Legend.LegendEntries.Append(objLE)
objLE.LoadData()
GMMapView1.Fit()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
clp = CreateObject("GeoMedia.ClipBoardService")
clp.SnapShot(GMMapView1.Dispatch)
End Sub
End Class