Jump to content
Software FX Community

Adding Buttons to Toolbar


Recommended Posts


I tried adding buttons to toolbar but it does not show them in the toolbar. I use the code as given in the examples. The graph code is given below (the command adding code is in BOLD),

Please help me on the following points,

1. Why the newly added command is not visible

2. How do I enumurate existing commands because there is no command collection object or there is no count property for command as it is not a collection object.

Note: I have seen some examples in the forum using CommandID enum object, but I could not find one in my chart FX. I am using Chart FX for .Net 6.2 and developing in VB.Net.


Graph.Gallery = SoftwareFX.ChartFX.Gallery.Lines

Graph.LineStyle = Drawing2D.DashStyle.Dot

Graph.AllowEdit =


Graph.Scrollable =

TrueGraph.Style = Not SoftwareFX.ChartFX.ChartStyle.Scrollbars


Graph.Commands(5).Style = SoftwareFX.ChartFX.CommandStyle.TwoState

Graph.Commands(5).Text = "Dressed"


Graph.Commands(6).Style = SoftwareFX.ChartFX.CommandStyle.SmartList

Graph.Commands(6).Text = "Points"

Graph.DataStyle = SoftwareFX.ChartFX.DataStyle.AllocHidden

' Set the graph's X-axis to a date/time format.

Graph.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.DateTime

Graph.MarkerShape = SoftwareFX.ChartFX.MarkerShape.None

Graph.SerLegBox =


Graph.SerLegBoxObj.Docked = SoftwareFX.ChartFX.Docked.Bottom

Graph.Zoom =


Graph.ToolBar =





Link to comment
Share on other sites

You created a custom command but you didn't assign it to any UI.

The Chart FX command infrastructure has a two-layer approach:

1) The commands

2) The UI that display those commands (toolbar, menu bar, context menus)

A command may be displayed by more than one UI like it is the case with many commands that show up in both the ChartFX toolbar and the context menus.

Now that you have created the command you have to add it to the UI you want it to appear. For example, you can insert it into the toolbar by doing:


new ToolBarItem(5)); // 5 being your command id


Link to comment
Share on other sites

Well, you are not assigning any image to your commands so the default image is going to show.

You can assign an image to your commands by doing:

int i = chart1.Commands.AddPicture(<image>);

chart1.Commands[6].Picture = i;

 Also, your code sets the style of command 6 to be SmartList. What are you trying to do with this one?

PS: This code is for Chart FX 6.2 but this post is in Chart FX for VS 2005. Which one are you using?

Link to comment
Share on other sites

Hi Frank,

Good morning and thanks for your reply.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I thought even without assigning a image the toolbar would show the blank button.

Smart List was added just to check what the type of control is. This is a sample code I am writing for a prototype.

I am using VS 2003. Do I need to post on different forum?

I very much appreciate your help.





Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...