Jump to content
Software FX Community

Adding sub-command to ContextMenuSeries using ChartFX 7.0 Wrapper


Ori
 Share

Recommended Posts

HI,

recently I upgrade from chartFX 6.2 to 7.0 using the Wrapper.

at the moment I'm facing many differences with the chart behavior, but the most annoying thing is that:

When I'm trying to add a sub-command to the Context Menu (as was before the wrapper), I get and an Out-Of-Range exception:

System.ArgumentOutOfRangeException occurred

Message=Specified argument was out of the range of valid values.

Parameter name: commandId

Source=ChartFX.WinForms

ParamName=commandId

StackTrace:

at ChartFX.WinForms.SubCommandCollection.a(Int32 A_0)

at ChartFX.WinForms.SubCommandCollection.Insert(Int32 index, Int32 commandId)

at SoftwareFX.ChartFX.Wrapper.Command.InsertSubCommands(Int32 index, Int32 commandId)

at SPC.frmSPC.SetChartCommands() in C:\SPC\SPC\frmSPC.cs:line 2303

InnerException:

-----------------------

I don't understand what went wrong.. and couldn't find any reference about that while using a wrapper.

please help.

Thank you!

this is the code I use:

private void SetChartCommands()

{

#region set the tool bars

this.cfxChart.ToolBar = true;

this.pbLegend.Visible = true;

Color myColor = Color.FromArgb(78, 119, 200);

this.cfxChart.ToolBarObj.BackColor = myColor;

this.cfxChart.ToolBarObj.RemoveAt(6,1);

SoftwareFX.ChartFX.Wrapper.CommandBar cmds = this.cfxChart.Commands;

cmds[(int)SoftwareFX.ChartFX.Wrapper.CommandID.PersonalizedOptions].Enabled = false;

cmds[(int)SoftwareFX.ChartFX.Wrapper.CommandID.Gallery].Enabled = false;

try

{

cmds[(int)SoftwareFX.ChartFX.Wrapper.CommandID.ContextMenuBack].RemoveSubCommand(4);

}

catch

{

}

cmds[(int)SoftwareFX.ChartFX.Wrapper.CommandID.ContextMenuSeries].RemoveSubCommand(0);

#endregion

#region add the cleaning command

this.cfxChart.Commands.AddCommand(4);

this.cfxChart.Commands[4].Style = SoftwareFX.ChartFX.Wrapper.CommandStyle.Transposed;

this.cfxChart.Commands[4].Text = "Clean/Unclean";

this.cfxChart.Commands[4].Picture = this.cfxChart.Commands.AddPicture(this.imageListTreeView.Images[7]);

this.cfxChart.Commands[(int)SoftwareFX.ChartFX.Wrapper.CommandID.ContextMenuSeries].InsertSubCommands(1, 0);

this.cfxChart.Commands[(int)SoftwareFX.ChartFX.Wrapper.CommandID.ContextMenuSeries].SubCommandID[0] = 4;

#endregion

...

Ori

Link to comment
Share on other sites

  • 1 year later...

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.

Guest
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.

 Share

×
×
  • Create New...