#1 Thu 04 September 2008 04:33
- Dougaz
- Juste Inscrit !
- Date d'inscription: 11 Jan 2008
- Messages: 3
code VB
bonjour a toutes et a tous,
svp, chui en train de mettre en place un outil qui permet de cartographier des données sur ArcGis (développement avec VB)
et là chui a l'etape mise en page, j'arrive pas a trouver le code qui permet de rajouter la légende a la "mise en page", bref, j'ai plusieurs couches dans mon projet, et j'ai besoin de rajouter que 3.
merci de m'envoyer le code si vous l'avez, et je le modifi suivant mon programme.
Dernière modification par Dougaz (Thu 04 September 2008 04:35)
Hors ligne
#2 Thu 04 September 2008 09:21
- Tnarbiv
- Participant assidu
- Lieu: Véretz
- Date d'inscription: 5 Sep 2005
- Messages: 392
Re: code VB
Voici une réponse trouver dans l'aide. Il ne te reste plus qu'à personnaliser un petit peu le code.
Code:
Public Sub AddMapSurrounds() Dim pMxDoc As IMxDocument Dim pActiveView As IActiveView Dim pEnv As IEnvelope Dim pID As New UID Dim pMapSurround As IMapSurround Dim pMarkerNorthArrow As IMarkerNorthArrow Dim pCharacterMarkerSymbol As ICharacterMarkerSymbol Set pMxDoc = Application.Document Set pActiveView = pMxDoc.PageLayout Set pEnv = New Envelope 'Add a legend 'In this case just use the default legend pEnv.PutCoords 1, 1, 3.4, 2.4 pID.Value = "esriCarto.Legend" Set pMapSurround = CreateSurround(pID, pEnv, "Legend", pMxDoc.FocusMap, pMxDoc.PageLayout) 'Refresh the graphics pActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing End Sub Private Function CreateSurround(pID As UID, pEnv As IEnvelope, strName As String, _ pMap As IMap, pPageLayout As IPageLayout) As IMapSurround Dim pGraphicsContainer As IGraphicsContainer Dim pActiveView As IActiveView Dim pMapSurroundFrame As IMapSurroundFrame Dim pMapSurround As IMapSurround Dim pMapFrame As IMapFrame Dim pElement As IElement 'MapSurrounds are held in a MapSurroundFrame 'MapSurroundFrames are related to MapFrames 'MapFrames hold Maps Set pGraphicsContainer = pPageLayout Set pMapFrame = pGraphicsContainer.FindFrame(pMap) Set pMapSurroundFrame = pMapFrame.CreateSurroundFrame(pID, Nothing) pMapSurroundFrame.MapSurround.Name = strName 'Set the geometry of the MapSurroundFrame to give it a location 'Activate it and add it to the PageLayout's graphics container Set pElement = pMapSurroundFrame Set pActiveView = pPageLayout pElement.Geometry = pEnv pElement.Activate pActiveView.ScreenDisplay 'Allow the legend frame size to be altered after the legend has been 'added to the GraphicsContainer Dim PTrack As ITrackCancel Set PTrack = New CancelTracker pElement.Draw pActiveView.ScreenDisplay, PTrack pGraphicsContainer.AddElement pElement, 0 'Re-apply the change to the Legend MapSurroundFrame Geometry pElement.Geometry = pEnv Set CreateSurround = pMapSurroundFrame.MapSurround End Function
Ayez le réflexe "Développement Durable": N'imprimez ce message que si nécessaire.
Hors ligne