Hi All,
I'm trying to add an image to a button on the ribbon.
I'm not sure if I have created this correctly, however, I have created a .Net dll with a bunch of png images as resources
This is the project structure:
BAResources
Properties
Assembly.cs
Resources.resx
References
...
Resources
Images
ButtonImages
EditLarge.png
EditSmall.png
InfoLarge.png
InfoSmall.png
Now in the "Ribbon" MapBasic example it has the following code:
Call SetRbnBtnCtrlLargeIcon(button1, New_Uri("pack://application:,,,/MapInfo.StyleResources;component/Images/Mapping/openTable_32x32.png", 0))
This BAResources.dll will reside in the same directory as my mbx.
[Question 1]
How do I write my URI?
[Question 2]
Also for the new routine calls like SetRbnBtnCtrlLargeIcon(), where do I find the documentation, did a search in the MapBasic help and it didn't find anything?
Kind regards
Hi,
Let me start with the later question.
The documentation for the .NET API can be found in the ExtensibilityReferenceHelp.exe.
That’s a separate help file to the normal MapBasic Help file
Be aware that SetRbnBtnCtrlLargeIcon is the MapBasic name for a method in a .NET assembly.
So you need to locate this name in the MapInfoPro.def file, notice what class it refers to (here MapInfo.Types.IRibbonButtonControl) and then find the help for this class in the before mentioned Help file.
As for the images, I haven’t yet tried to create my own assemblies containing custom icons/images.
So I’m not entirely sure how to refer to the image.
Looking at the string for the built-in images, it could be something along this:
"pack://application:,,,/MapInfo.StyleResources;component/Images/Mapping/openTable_32x32.png"
"pack://application:,,,/someassemblyname;BAResources/Images/ ButtonImages/EditLarge.png.png"
But I haven’t tried it. Maybe this can be of more assistance:
So far I have just used images stored in a folder in my application directory.
Peter Horsbøll Møller
EMEA Channel Enablement Specialist
Location Intelligence | MapInfo
M: +45 29 133 769
--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en
---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
mapinfo-l+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Properties/Resources/LineAddSm.png' as that's still wrong)Call SetRbnBtnCtrlSmallIcon(BA_Btn, New_Uri("pack://application:/BAResources;Properties/Resources/LineAddSm.png", 0))Hi Hank,
I’ve never used a .NET library for resources so I’m no expert, but a few things you could try:
- Check that your path is using the correct slash (forward or backward) – maybe just try both and see if either works?
- Check whether the slashes in the path need an escape character to be read correctly? In C# the escape character is ‘\’
- Check that you set the resources as Embedded Resources when creating the DLL – if not, they won’t be included in the assembly!
No guarantee any of these will work but these are the first things I would check.
HTH,
Tom
Hi Tom,
If what you're saying about the slash being backwards is true, may mean all the MapBasic ribbon examples are wrong. This may be the case as I haven't been able to get the button images to work on these either.
Will have to try this in the morning as its midnight here.
Kind regards H
> This email is sent on behalf of Kier Group. This email and any attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the addressee, please do not use or publish its contents, please notify Kier Group on +44 (0) 845 607 7000 immediately and then delete it. Contracts cannot be concluded with us nor services effected by email. Emails are not secure and may contain viruses, you are advised to scan all messages for viruses with your own anti-virus programme. Kier Group may monitor emails
> _________________________________________________________________________
>
> To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> _________________________________________________________________________
> This email is sent on behalf of Kier Group. This email and any attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the addressee, please do not use or publish its contents, please notify Kier Group on +44 (0) 845 607 7000 immediately and then delete it. Contracts cannot be concluded with us nor services effected by email. Emails are not secure and may contain viruses, you are advised to scan all messages for viruses with your own anti-virus programme. Kier Group may monitor emails
> _________________________________________________________________________
>
> --
> --
> You received this message because you are subscribed to the
> Google Groups "MapInfo-L" group.To post a message to this group, send
> email to mapi...@googlegroups.com
> To unsubscribe from this group, go to:
> http://groups.google.com/group/mapinfo-l/subscribe?hl=en
> For more options, information and links to MapInfo resources (searching
> archives, feature requests, to visit our Wiki, visit the Welcome page at
> http://groups.google.com/group/mapinfo-l?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+unsubscribe@googlegroups.com.
> _________________________________________________________________________
> This email is sent on behalf of Kier Group. This email and any attachments are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the addressee, please do not use or publish its contents, please notify Kier Group on +44 (0) 845 607 7000 immediately and then delete it. Contracts cannot be concluded with us nor services effected by email. Emails are not secure and may contain viruses, you are advised to scan all messages for viruses with your own anti-virus programme. Kier Group may monitor emails
> _________________________________________________________________________
>
> --
> --
> You received this message because you are subscribed to the
> Google Groups "MapInfo-L" group.To post a message to this group, send
> email to mapi...@googlegroups.com
> To unsubscribe from this group, go to:
> http://groups.google.com/group/mapinfo-l/subscribe?hl=en
> For more options, information and links to MapInfo resources (searching
> archives, feature requests, to visit our Wiki, visit the Welcome page at
> http://groups.google.com/group/mapinfo-l?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
Cliff,
Make sure that you have a full path to the dll, for example by adding ApplicationDirectory$() to the path.
Also, here is an example of the naming of the built-in images:
"pack://application:,,,/MapInfo.StyleResources;component/Images/Application/closeAll_16x16.png"
Notice that it also has the filetype, but I assume that’s just the way the resource was named in the assembly.
You can always reference a file on disk using the same syntax but replacing the entire pack string with the path and file name:
Call SetRbnToolBtnCtrlLargeIcon(NuggetPointSelectTool, New_Uri(ApplicationDirectory$() & "NiceImage32.png", 0))
I found this more detailed description of the syntax:
"pack://addinorigin:,,,/{absolute path to resource assembly};component/{location of image in assembly with image name}"
example : "pack://addinorigin:,,,/D:/folder/CustomResource.dll;component/Images/testImage.png"
Peter Horsbøll Møller
Pitney Bowes