Troubleshooting
- 3 minutes to read
The DevExpress Project Converter updates your projects automatically and converts the changed API without causing errors. The following article describes possible issues and troubleshooting tips when you migrate your project to the DevExpress.Drawing graphics library.
Use the DevExpress.Drawing Library Reference
If you use the DevExpress.Drawing
library reference instead of a NuGet package to enable the Skia engine, you may wish to add references to the following packages:
- HarfBuzzSharp.NativeAssets.Linux
- SkiaSharp
- SkiaSharp.HarfBuzz
- SkiaSharp.NativeAssets.Linux
- System.Drawing.Common
Notes on the System.Drawing Reference
While the main goal of the DevExpress.Drawing
library is to replace the System.Drawing
library dependency, some of the products still reference this library. This dependency is required for the following reasons:
- Multiple DevExpress products share a set of so-called “core” assemblies. These assemblies include a reference to
System.Drawing
to handle fonts, images, and printing. For instance, theDevExpress.Data
assembly referencesSystem.Drawing.Common
>=4.7.2, which is necessary for GDI+ environments like Windows (for example, in .NET Framework-based WinForms apps with Reporting). - Libraries such as WinForms Charts and PDF share the same codebase with multiple products. To limit the impact on DevExpress-powered WinForms apps, we duplicated public APIs (Font and Image to DXFont and DXImage respectively) and retained references to
System.Drawing
.
Tips for the System.Drawing
library dependency:
You can use the
System.Drawing.Primitives
package in your cross-platform apps. Utilizing structures like PointF and SizeF won’t cause runtime exceptions.The System.PlatformNotSupported exception occurs in non-Windows environments if your .NET app refers to System.Drawing.Common >= 6.0.0. This reference may arise from third-party libraries; for example, adding a System.Security.Permissions package creates a System.Drawing.Common 7.0.0 dependency. DevExpress assemblies only reference System.Drawing.Common 5.0.3.
Reporting Applications Troubleshooting
Adjust Font Settings
The following API has the DXFont type:
- BrickGraphics.Font
- BrickGraphics.DefaultFont
- BrickStyle.Font
- BrickStyle.DefaultFont
- PageWatermark.Font
- TextBrick.Font
- XRControlStyle.Font
- XRControl.Font
- BarCodeCaption.Font
- BarCode.CodeTextFont
An issue might occur with missing font properties, such as FontFamily
, GdiCharSet
, and so on.
Replace the FontFamily Property
To resolve the issue with the Font.FontFamily property, replace the Font
class initialization with DXFont
. Use the DXFont.Name property instead of the FontFamily
property when creating a new font:
Specify GDI+ Properties
You can use the DXFontAdditionalProperty class to pass additional properties (including GDI+ properties) to the font. The additional property’s name should match the property in the Font
class.
The code sample below specifies a Font.GdiCharSet to the DXFont
type:
DXFont font = new DXFont("Font", 14, DXFontStyle.Regular,
DXGraphicsUnit.Point, new DXFontAdditionalProperty[] {
new DXFontAdditionalProperty(DXFontAdditionalProperty.GdiCharSet, (byte)0) });
Note
The GDI+ font settings work only on Windows OS and GDI+ drawing.
Use Custom Fonts
You can use the class for custom fonts. Refer to the following article for more information: Use DXFontRepository to Add Custom Fonts
Handle the BeforePrint Event
In the scope of the T1125446 breaking change, the XRControl.BeforePrint uses the DevExpress.XtraReports.UI.BeforePrintEventHandler delegate and the CancelEventArgs
class. The PrintOnPageEventArgs class now descends from CancelEventArgs
as well.
You can change your event handlers as follows:
using DevExpress.XtraReports.UI;
using System.ComponentModel;
xrControl1.BeforePrint += new BeforePrintEventHandler(xrControl1_BeforePrint)
xrControl1.BeforePrint -= new BeforePrintEventHandler(xrControl1_BeforePrint)
//...
private void xrControl1_BeforePrint(object sender, CancelEventArgs e)
{
//...
}