Hi everyone!
While I updated our program with the latest version of StimulReports, i had to change some lines of Code in our custom components.
here some code:
public class Datamatrix : StiComponent, IStiBorder, IStiBrush, IStiExportImage
{
#region CodeValue
private string codeValue;
private StiComponentGdiPainter painter;
....
....
public override void Paint(StiPaintEventArgs e)
{
InvokePainting(this, e);
if (!e.Cancel)
{
Graphics g = e.Graphics;
RectangleD rect = GetPaintRectangle();
if (rect.Width > 0 && rect.Height > 0 && (e.ClipRectangle.IsEmpty || rect.IntersectsWith(e.ClipRectangle)))
{
#region Fill rectangle
if (this.Brush is StiSolidBrush &&
((StiSolidBrush)this.Brush).Color == Color.Transparent &&
Report.Info.FillComponent &&
IsDesigning)
{
Color color = Color.FromArgb(150, Color.Green);
StiDrawing.FillRectangle(g, color, rect.Left, rect.Top, rect.Width, rect.Height);
}
else StiDrawing.FillRectangle(g, Brush, rect);
#endregion
using (Bitmap bmp = new Bitmap((int)rect.Width, (int)rect.Height))
using (Graphics gr = Graphics.FromImage(bmp))
{
Barcodes.DataMatrix.DataMatrixControl MyBarcode = new Barcodes.DataMatrix.DataMatrixControl();
if (!String.IsNullOrEmpty(this.codeValue))
MyBarcode.DataToEncode = this.codeValue;
MyBarcode.DrawMatrixToSize(0, 0, rect.Width, rect.Height,
Barcodes.DataMatrix.Dimensions.dmPixels, gr);
g.DrawImage(bmp, rect.ToRectangleF());
}
#region Markers
painter.PaintMarkers(this,g, rect);
#endregion
#region Border
if (this.HighlightState == StiHighlightState.Hide)
Border.Draw(g, rect, Page.Zoom);
#endregion
painter.PaintEvents(this,e.Graphics, rect);
}
}
e.Cancel = false;
InvokePainted(this, e);
}
In our "old" version of this Code / StimulReports "PaintMarkers()" and "PaintEvents()" seemed to be part of StiComponent. In the new version of StimulReports are the 2 Methods part of the "StiComponentGdiPainter".
Now i have the problem, that the code throws an NullReferenceException on the first Red-marked line.
How to solve this problem?
Thanks,
Jens, EDV Gradl
custom StiComponent -> NullReferenceException
custom StiComponent -> NullReferenceException
I saw, that most of the Code was taken from the MyCustomComponent-Sample...
The StiComponentGdiPainter was not used in this Sample, but without this, there Error's that PaintMarkers(g, rect); and PaintEvents(e.Graphics, rect); were not found. So i searched with the Object-browser and i found the StiComponentGdiPainter who supports this methods. Now i stuck in this "unusable" Code and i cannot deliver the new version, so plz help!
The StiComponentGdiPainter was not used in this Sample, but without this, there Error's that PaintMarkers(g, rect); and PaintEvents(e.Graphics, rect); were not found. So i searched with the Object-browser and i found the StiComponentGdiPainter who supports this methods. Now i stuck in this "unusable" Code and i cannot deliver the new version, so plz help!
custom StiComponent -> NullReferenceException
Hello,
Please send all code of your custom component to support[at]stimulsoft.com for analysis.
We have to check its behavior and then we would be able to answer you with a solution.
Thank you.
Please send all code of your custom component to support[at]stimulsoft.com for analysis.
We have to check its behavior and then we would be able to answer you with a solution.
Thank you.
custom StiComponent -> NullReferenceException
ok i wrote u an email
custom StiComponent -> NullReferenceException
Hello,
Problem solved. Please take patch from 21 June.
Thank you.
Problem solved. Please take patch from 21 June.
Thank you.