custom Open button on chartcontroller

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
TL123
Newbie
Newbie
Posts: 9
Joined: Wed Jan 27, 2016 12:00 am

custom Open button on chartcontroller

Post by TL123 » Mon Feb 08, 2016 3:38 pm

I am sure this has been asked before but I could not find it.

How do I add a button to the chartcontroller next to the save button?
It has to be a open button so the user can both save and open a file.
I prefere do do it by code.

PS when I try to add a toolstripitem in design mode VS2015 shows a error: "Cannot create an abstract class"

Regards Torben

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: custom Open button on chartcontroller

Post by Christopher » Tue Feb 09, 2016 11:54 am

Hi Torben,

You should be able to control the items in the chartcontroller using code similar to that indicated in the answer to this post.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

TL123
Newbie
Newbie
Posts: 9
Joined: Wed Jan 27, 2016 12:00 am

Re: custom Open button on chartcontroller

Post by TL123 » Tue Feb 09, 2016 12:05 pm

Hi,

I dont understand how the single code line in the link helps me adding a custom button.
Can you give a simple code example that shows how to add a button next to the save button?

Regards Torben

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: custom Open button on chartcontroller

Post by Christopher » Thu Feb 11, 2016 10:02 am

Hello Torben,

You could try:

Code: Select all

    private void button4_Click(object sender, EventArgs e)
    {
      ToolStripButton button = new ToolStripButton("My Button", Image.FromFile(@"D:\tmp\orion.png"), Button_Click);
      button.ImageAlign = ContentAlignment.MiddleCenter;
      button.ImageScaling = ToolStripItemImageScaling.SizeToFit;
      ((ToolStrip)chartController1).AutoSize = true;
      ((ToolStrip)chartController1).Items.Insert(((ToolStrip)chartController1).Items.Count - 1, button);
    }

    private void Button_Click(object sender, EventArgs e)
    {
      MessageBox.Show("Alnitak");
    }
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

TL123
Newbie
Newbie
Posts: 9
Joined: Wed Jan 27, 2016 12:00 am

Re: custom Open button on chartcontroller

Post by TL123 » Thu Feb 11, 2016 10:41 am

Thanks. Just what I needed

Regards Torben

Post Reply