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
Passing a Color reference to a ChartPen
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jeff,
You can try using a variable of System.Drawing.Color type:
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 |
Instructions - How to post in this forum |
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:
With this function , the following code works:
Jeff
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);