Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How do you add a BaseCommand to a custom BaseToolbar as an icon and text. This is not an Add-In, it's the old way of doing buttons and toolbars even though it's version 10 of ArcMap.

Cheers

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I didn't try the solution in the thread below but it looks correct to me: How to show caption and icon for basecommand

Depending on how your toolbar is setup, the check for Enabled() can happen frequently. You may want to add a boolean flag to keep the SetAsIconAndText() function from constantly running.

share|improve this answer
    
I think it should probably be set up through NewDocument method of a bland Extension class. (I tried to find an example of this question on the forums but obviously used the wrong search words - nice find!) –  Vidar Feb 14 '12 at 13:45

You need to create a toolbar class, IToolbarDef, to reference your BaseCommand icons to. Then create a resource bitmap and reference it in your BaseCommand class, see example below:

Public Sub New()
        MyBase.New()


        MyBase.m_category = "Developer Samples"
        MyBase.m_caption = "Export Active View VisualBasic .NET"
        MyBase.m_message = "Exports the Active View using VisualBAsic .NET"
        MyBase.m_toolTip = "Export PDFs"
        MyBase.m_name = Me.GetType().Name + ""

        Try
            'load the bitmap resource (the icon for this tool).
            Dim bitmapResourceName As String = Me.GetType().Name + ".bmp"
            MyBase.m_bitmap = New Bitmap(Me.GetType(), bitmapResourceName)
        Catch ex As Exception
            System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap")
        End Try


    End Sub
share|improve this answer
    
This only shows the icon - but I also need text next to it as well. I think it has something to do with: ESRI.ArcGIS.SystemUI.esriCommandStyles.esriCommandStyleIconAndText –  Vidar Feb 9 '12 at 9:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.