Chart Bevel Settings Not Working as Expected (Regression)

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Chart Bevel Settings Not Working as Expected (Regression)

Post by Kris C » Wed Jun 21, 2023 3:17 pm

Hello,

In the attached zip file is a Word doc that contains screen captures showing Bevel settings in two different versions of TeeChart. On the left is from v2009 and on the right is v2023.

Reproducing this is very simple and doesn't warrant a sample project. However, I have attached a sample project anyway.

Kind Regards,

Kris Culin
Bentley Systems, Inc.
Attachments
TeeChartNET60.zip
Sample project
(8.04 KiB) Downloaded 935 times
Bevel differences.zip
Contains screen captures showing bevel not working
(463.19 KiB) Downloaded 877 times

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

Re: Chart Bevel Settings Not Working as Expected (Regression)

Post by Christopher » Wed Jun 21, 2023 6:10 pm

Hello Kris,

thank you for reporting this issue to us, I have documented it in id=2617. The git diff is:

Code: Select all

diff --git a/TeeChart.PCL.NET5/TeeChart.WinForm/Drawing/Canvas.cs b/TeeChart.PCL.NET5/TeeChart.WinForm/Drawing/Canvas.cs
index 65717a7d..0e44267f 100644
--- a/TeeChart.PCL.NET5/TeeChart.WinForm/Drawing/Canvas.cs
+++ b/TeeChart.PCL.NET5/TeeChart.WinForm/Drawing/Canvas.cs
@@ -5684,42 +5684,26 @@ System.ComponentModel.Description("Sets the alignment used when displaying text
             Line(b, BottomRight, TopRight);
         }
 
-        private ChartPen a, b;
+        private ChartPen _a = new ChartPen(), _b = new ChartPen();
 
         public void PaintBevel(BevelStyles bevel, Rectangle rect, int width, Color one, Color two)
         {
             if (bevel == BevelStyles.Raised)
             {
-                if (a == null || b == null)
-                {
-                    a = new ChartPen(Chart, one);
-                    b = new ChartPen(Chart, two);
-                }
-                else
-                {
-                    a.Color = one;
-                    b.Color = two;
-                }
+                _a.Color = one;
+                _b.Color = two;
             }
             else
             {
-                if (a == null || b == null)
-                {
-                    a = new ChartPen(Chart, two);
-                    b = new ChartPen(Chart, one);
-                }
-                else
-                {
-                    a.Color = two;
-                    a.Color = one;
-                }
+                _a.Color = two;
+                _b.Color = one;
             }
 
             var tmp = width;
             while (tmp > 0)
             {
                 tmp--;
-                DoBevelRect(rect, a, b);
+                DoBevelRect(rect, _a, _b);
                 Utils.InflateRect(ref rect, -1, -1);
             }
         }
diff --git a/TeeChart/Drawing/Canvas.cs b/TeeChart/Drawing/Canvas.cs
index db0d942a..ce770c14 100644
--- a/TeeChart/Drawing/Canvas.cs
+++ b/TeeChart/Drawing/Canvas.cs
@@ -11831,7 +11831,7 @@ public abstract void Draw(Rectangle destRect, Rectangle srcRect, CGImage image,
             Line(b, BottomRight, TopRight);
         }
 
-        private ChartPen a, b;
+        private ChartPen _a = new ChartPen(), _b = new ChartPen();
 
 #if WPF || SILVERLIGHT || STORE
     public void PaintBevel(BevelStyles bevel, Rect rect, int width, Color one, Color two)
@@ -11841,36 +11841,20 @@ public abstract void Draw(Rectangle destRect, Rectangle srcRect, CGImage image,
         {
             if (bevel == BevelStyles.Raised)
             {
-                if (a == null || b == null)
-                {
-                    a = new ChartPen(one);
-                    b = new ChartPen(two);
-                }
-                else
-                {
-                    a.Color = one;
-                    b.Color = two;
-                }
+                _a.Color = one;
+                _b.Color = two;
             }
             else
             {
-                if (a == null || b == null)
-                {
-                    a = new ChartPen(two);
-                    b = new ChartPen(one);
-                }
-                else
-                {
-                    a.Color = two;
-                    a.Color = one;
-                }
+                _a.Color = two;
+                _b.Color = one;
             }
 
-            int tmp = width;
+            var tmp = width;
             while (tmp > 0)
             {
                 tmp--;
-                DoBevelRect(rect, a, b);
+                DoBevelRect(rect, _a, _b);
                 Utils.InflateRect(ref rect, -1, -1);
             }
         }
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

Post Reply