TE Edit Control .NET Core / .NET Framework Help
Product page

TerAddToolbarIcon

Add a new icon to the toolbar

bool TerAddToolbarIcon(LineNo, TlbId, CmdId, BmpFile, balloon)
bool TerAddToolbarIcon3(LineNo, TlbId, CmdId, image, balloon)
int LineNo;Set to 0 to add the icon to the top row of the toolbar. Set to 1 to add this icon to the bottom row of the toolbar.
int TlbId;

Set this parameter to one of the toolbar ids. Please refer to TerEditTooltip function for a list of toolbar icon ids. This would add an existing toolbar icon. The CmdId and BmpFile parameters are ignored when this parameter is non-zero.

Set this parameter to 0 to add a new tool bar icon.

int CmdId;

When the TlbId parameter is set to zero, use the CmdId parameter to specify the command id for the new toolbar icon. Please refer to the 'Command' property for a list of existing command ids.

You can use command ids ID_USER1 to ID_USER9 to implement functionality not provided by the existing command ids. For example, you can use ID_USER1 to implement PDF output icon. You would intercept ID_USER1 using the PreProcess event and execute your code there. Then call the TerIgnoreCommand method to tell the editor to ignore this command.

string BmpFile;The bitmap file to draw the toolbar icon. The toolbar icon consists of 24x24 pixels. Therefore, the picture must be at least 24 pixels wide and 24 pixels tall. Only first 24x24 pixels are used. The remaining pixels are ignored. This parameter is used by the TerAddToolbarIcon method only.
Image imageThe image object to draw the toolbar icon. The toolbar icon consists of 24x24 pixels. Therefore, the picture must be at least 24 pixels wide and 24 pixels tall. Only first 24x24 pixels are used. The remaining pixels are ignored. This parameter is used by the TerAddToolbarIcon3 method only.
string balloon; The tool tip text string.

Example:

// create a custom icon and connect it to 
   the ID_PARA_KEEP COMMAND
tern.TerAddToolbarIcon(0,0,tc.ID_PARA_KEEP,"pict.bmp","Keep");
tern.TerAddToolbarIcon(0,tc.TLB_SPACER,0,null,null); 
tern.TerAddToolbarIcon(0,tc.TLB_LINE,0,null,null);
// add an existing 'paste' icon
tern.TerAddToolbarIcon(0,tc.TLB_SPACER,0,null,null);
tern.TerAddToolbarIcon(0,tc.TLB_PASTE,0,null,null);
tern.TerAddToolbarIcon(0,tc.TLB_SPACER,0,null,null); 
tern.TerAddToolbarIcon(0,tc.TLB_LINE,0,null,null);
// refresh the toolbar
tern.TerRecreateToolbar(true);  

Return Value: This function returns a TRUE value if successful.