This post shows the code I'm using to insert an image into the page layout. It works fine, but it's using a hard coded path. Adding picture to ArcMap PageLayout using ArcObjects in .NET?
Currently my code looks for the image in the user's ArcGIS folder, or if not there at a shared network folder, or else it doesn't insert it.
strPath1 = Environ("USERPROFILE") + "\Documents\ArcGIS\logo.bmp"
strPath2 = "Z:\networkfolder\logo.bmp"
If Exists(strPath1) Then
picElement5.ImportPictureFromFile(strPath1)
ElseIf Exists(strpath2) Then
picElement5.ImportPictureFromFile(strPath2)
Else
Dim Result As DialogResult
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Result = MessageBox.Show("image not found, not inserted", "title", Buttons)
Exit Sub
End If
What I would like to do is include the image in the Images folder of the AddIn. In the Config.esriaddinx file it allows images to be used from a subfolder, but picElement5.ImportPictureFromFile doesn't support relative paths.
Is there a different method to import an image into the page layout or a way to install them image into a standard folder that would work for all users. I need to distribute this addin to other users in the office.
I'm using ArcGIS 10.6, VB in Visual Studio 2017.