Hide Table of Contents
AddToolbar5 Method (ISldWorks)

Creates a Windows-style dockable toolbar.

.NET Syntax

Visual Basic (Declaration) 
Function AddToolbar5( _
   ByVal Cookie As System.Integer, _
   ByVal Title As System.String, _
   ByVal ImageList As System.Object, _
   ByVal MenuPositionForToolbar As System.Integer, _
   ByVal DocumentType As System.Integer _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Cookie As System.Integer
Dim Title As System.String
Dim ImageList As System.Object
Dim MenuPositionForToolbar As System.Integer
Dim DocumentType As System.Integer
Dim value As System.Integer
 
value = instance.AddToolbar5(Cookie, Title, ImageList, MenuPositionForToolbar, DocumentType)
C# 
System.int AddToolbar5( 
   System.int Cookie,
   System.string Title,
   System.object ImageList,
   System.int MenuPositionForToolbar,
   System.int DocumentType
)
C++/CLI 
System.int AddToolbar5( 
&   System.int Cookie,
&   System.String^ Title,
&   System.Object^ ImageList,
&   System.int MenuPositionForToolbar,
&   System.int DocumentType
) 

Parameters

Cookie

Resource ID of the toolbar; this is the same cookie that you specified in ISwAddin::ConnectToSW

Title
Title of the toolbar
ImageList
Array of strings of the paths for the icons for the toolbar (see Remarks)
MenuPositionForToolbar

Not used (SOLIDWORKS always puts toolbar names in alphabetical order)

DocumentType

Bitwise values indicating what frame window types should have this toolbar's name added to the View > Toolbars menu; values from swDocTemplateTypes_e

Return Value

Toolbar ID for use with other methods or -1 if not created

Example

Remarks

For information about using this method with the ISwAddin object, see Using ISwAddin to Create a SOLIDWORKS Add-in.

 

This method:

  • only operates properly when the application is implemented as a .dll and not as an .exe.

  • adds the toolbar name to the View > Toolbars menu.

  • only creates the toolbar and passes the images for the icons to SOLIDWORKS. To add functionality, use ISldWorks::AddToolbarCommand2.

  • supports scaling for high resolution screens with high resolution operating system scaling options. 

ImageList icons can be:

  • 20 x 20 pixels
  • 32 x 32 pixels
  • 40 x 40 pixels
  • 64 x 64 pixels
  • 96 x 96 pixels
  • 128 x128 pixels 

Each image file (.bmp or .png) should contain all of the same-size icons for the toolbar buttons and separators. For example:

Each icon strip should use a 256-color palette.

NOTES:  

  • When your add-in is unloaded, you must call ISldWorks::RemoveToolbar2 to remove this toolbar.

  • If you want the toolbar to show up in specific locations only, do not use the now obsolete ISldWorks::ShowToolbar2 method. If your application uses that method, your application ignores the DocumentType argument. ISldWorks::ShowToolbar2 assumes that the application is controlling the visibility state of the toolbar, and not the user. This means that the toolbar will be available in all locations.

 

See Also

Availability

SOLIDWORKS 2016 FCS, Revision Number 24.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   AddToolbar5 Method (ISldWorks)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2020 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.