Passing a Color reference to a ChartPen

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Passing a Color reference to a ChartPen

Post by Jeff » Fri May 04, 2007 4:51 pm

How do I pass a Color reference to a ChartPen so that when the Color property of the ChartPen changes, my Color reference changes accordingly? Thank you.

Jeff

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon May 07, 2007 10:38 am

Hi Jeff,

You can try using a variable of System.Drawing.Color type:

Code: Select all

					System.Drawing.Color MyColor = Color.FromArgb(255, 0, 0);
					line1.LinePen.Color = MyColor;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Tue May 08, 2007 6:38 pm

I am afraid the code you provide does not work: if one changes the Color of LinePen, MyColor won't get the change.

Anyway, I solved this by adding a public function in the ChartPen class:

Code: Select all

        public void SetColorref(ref Color color)
        {
            color = this.Color;
        }

With this function , the following code works:

Code: Select all

Color MyColor = Color.FromArgb(255, 0, 0);
line1.LinePen.Color.SetColorref(ref MyColor);
Jeff

Post Reply