override default icons...

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

override default icons...

Post by lidds »

Is there a way to override the default icons with my own?

Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: override default icons...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Yes it is possible by replacing the IUIX_Icon of the needed IUIX_Cmd.
Please use forum search for the "Icon" keyword for more details.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: override default icons...

Post by lidds »

Alex,

Would you be able to give me a quick example of how to override the default icon, for say the bookmark icon in the attached image.
icon.png
I know that you prefer to have forum users supply some code, but I am really stuck with this.

Thanks in advance

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: override default icons...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Check this topic:
https://forum.pdf-xchange.com/ ... con#p98962

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: override default icons...

Post by lidds »

Hi Alex,

Thanks I have got it working, but one last question this is using a physical file location. Is it possible to use an image from my project Resources?

Code: Select all

    Public Sub changeIconImg()
        Dim cmd As PDFXEdit.IUIX_Cmd = uiInst.CmdManager.Cmds.Find("cmd.view.bookmarks")
        Dim myIcon As PDFXEdit.IUIX_Icon = GetIcon("D:\Icons\Logo_24.png")
        cmd.Icon = myIcon
    End Sub

Code: Select all

    Public Function GetIcon(IconPath As String) As PDFXEdit.IUIX_Icon
        Dim Icon As PDFXEdit.IUIX_Icon = Nothing

        If System.IO.File.Exists(IconPath) Then
            Dim name As PDFXEdit.IAFS_Name = fsInst.DefaultFileSys.StringToName(IconPath)
            Dim file As PDFXEdit.IAFS_File = fsInst.DefaultFileSys.OpenFile(name, CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read) Or CInt(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead))
            Icon = uiInst.CreateIconFromIStream(file.GetStream())
        End If

        Return Icon
    End Function
Thanks

Simon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: override default icons...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Well your project's Resources also have a physical location, for example:

Code: Select all

string sFileName = System.IO.Directory.GetParent(System.Environment.CurrentDirectory).Parent.FullName + "\\Resources\\calculator.png";
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: override default icons...

Post by lidds »

Alex,

Don't worry I figured it out. Thanks for all your help

Code: Select all

Dim cmd As PDFXEdit.IUIX_Cmd = uiInst.CmdManager.Cmds.Find("cmd.view.bookmarks")
        Dim Icon As PDFXEdit.IUIX_Icon = Nothing
        Dim i As Bitmap = Bitmap.FromHbitmap(My.Resources.Logo_24.GetHbitmap())
        Icon = uiInst.CreateIconFromHandle(CUInt(i.GetHicon()))
        cmd.Icon = Icon
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: override default icons...

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply