Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 350 - [TD29016645] There is a strange problem when you do Ctrl+Alt+Supr with Direct2D de...
Summary: [TD29016645] There is a strange problem when you do Ctrl+Alt+Supr with Direct...
Status: IN_PROGRESS
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Direct2D (show other bugs)
Version: unspecified
Hardware: All All
: Normal major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-17 13:09 EDT by sandra pazos
Modified: 2019-01-25 03:28 EST (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
Screenshot of the Direct2D error (177.04 KB, image/png)
2013-11-27 10:24 EST, christopher ireland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sandra pazos 2013-11-20 11:25:02 EST
There is a strange problem when you do Ctrl+Alt+Supr with Direct2D demo project. To reproduce the problem with demo, you need follow next steps:
1.- Open Demo Direct2D
2.- Do Ctrl+Alt+Supr
3.- Return to the session.
A similar problem occurs if you run the attach project and open Task Manager, doing ctrl+Alt+Supr, when the project is running. The problem causes and exception in the method ShowImage
public override void ShowImage(Graphics g)
    {
      if (!gd.IsOccluded)
      {
        gd.EndDraw();
      }
      //DisposeObj();
      base.ShowImage(g);
    }
And also I have attached an image where you see the error there appears in the project in the design time. 
Thread: http://www.teechart.net/support/viewtopic.php?f=4&t=14198 [created:2013-07-17T12:09:00.000+01:00 reported by:sandra@steema.com reported in version:]
Comment 1 christopher ireland 2013-11-27 10:24:17 EST
Created attachment 37 [details]
Screenshot of the Direct2D error
Comment 2 sandra pazos 2013-11-27 10:26:58 EST
(In reply to chris ireland from comment #0)
> And also I have attached an image where you see the error there appears in
> the project in the design time. 
> Thread: http://www.teechart.net/support/viewtopic.php?f=4&t=14198
> [created:2013-07-17T12:09:00.000+01:00 reported by:sandra@steema.com
> reported in version:]

Have been able to reproduce this error here using the SlimDX source code. The error is shown in the attached screenshot.

The error seems to be coming from Direct2D itself and not from either the SlimDX or the TeeChart API. I have been unable to find a resolution to this problem for the moment.
Comment 3 henrik.surm+bugzilla 2019-01-25 03:28:33 EST
I found a workaround for this problem. Subclass TChart, catch the exception in OnPaint an recreate the Graphics3D object:

using System.Windows.Forms;
using SlimDX.Direct2D;
using Steema.TeeChart;
using Steema.TeeChart.Drawing.Direct2D;

public class TChartEx : TChart
{
    protected override void OnPaint(PaintEventArgs pe)
    {
        try
        {
            base.OnPaint(pe);
        }
        catch (Direct2DException e)
        {
            if (e.ResultCode == ResultCode.RecreateTarget)
            {
                var oldGraphics = Graphics3D;
                Graphics3D = new Graphics3DDirect2D(Chart);

                // Copy properties of old Graphics object
                Graphics3D.BufferStyle = oldGraphics.BufferStyle;
                Graphics3D.BackColor = oldGraphics.BackColor;
                Graphics3D.Brush = oldGraphics.Brush;
                Graphics3D.Font = oldGraphics.Font;
                Graphics3D.FourPoints = oldGraphics.FourPoints;
                Graphics3D.Gradient = oldGraphics.Gradient;
                Graphics3D.NameElements = oldGraphics.NameElements;
                Graphics3D.Pen = oldGraphics.Pen;
                Graphics3D.RotationCenter = oldGraphics.RotationCenter;
                Graphics3D.RotationCenterFloat = oldGraphics.RotationCenterFloat;
                Graphics3D.SmoothingMode = oldGraphics.SmoothingMode;
                Graphics3D.Supports3DText = oldGraphics.Supports3DText;
                Graphics3D.SupportsID = oldGraphics.SupportsID;
                Graphics3D.Tag = oldGraphics.Tag;
                // Add more properties if needed

                oldGraphics.Dispose();
            }
            else
                throw;
        }
    }
}