We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Passing ASPOSE Drawing types to .NET Framework functions/properties that use system.drawing types

Hi,
I’m looking at replacing system.drawing and system.drawing.common in an ASP.NET webforms app. The problem I’ve run into when we need to pass a type from the ASPOSE Drawing to .NET

        tablecellDashboardLow.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + datasetFullDetails.Tables[14].Rows[0][@"DashboardDialLow"].ToString());
        tablecellDashboardMedium.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + datasetFullDetails.Tables[14].Rows[0][@"DashboardDialMedium"].ToString());
        tablecellDashboardHigh.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + datasetFullDetails.Tables[14].Rows[0][@"DashboardDialHigh"].ToString());

Which gives the following errors,

4>C:\SC2\CiticusONE\Source\Main\Web applications\WebSite\c1_determinationofacceptablerisk_edit.aspx.cs(595,35,595,44): error CS0012: The type ‘Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.
4>C:\SC2\CiticusONE\Source\Main\Web applications\WebSite\c1_determinationofacceptablerisk_edit.aspx.cs(596,38,596,47): error CS0012: The type ‘Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.
4>C:\SC2\CiticusONE\Source\Main\Web applications\WebSite\c1_determinationofacceptablerisk_edit.aspx.cs(597,36,597,45): error CS0012: The type ‘Color’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

tablecellDashboard* are of System.Web.UI.WebControls.TableCell and BackColor is of System.Drawing.Color.

Is it possible to convert the types in ASPOSE Drawing to the .NET version?
Can you see another solution if this is not possible.

@michaelaston,

Aspose.Drawing for .NET API actually provides System.Drawing compatible API (where your code is using System.Drawing) to make it enhanced and fully/truly cross-platform, it is not the replacement to System.Drawing type. So, you need to add reference to System.Drawing in any case.

How can we have references to both ASPOSE Drawing and System.Drawing in same project without name clash issues?

@michaelaston,

You can use fully qualified naming with respective to its namespace(s) when defining or creating objects/variable. For reference, please go through documentation.