Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
How do I refer to Infragistics objects generically?
posted
private void AddTextToDocumentObject(ref object tempObj, string TextToAdd,int Relative_Width, Infragistics.Documents.Graphics.Font f,Infragistics.Documents.Graphics.Brush b, bool ApplyBold,bool ApplyItalic,bool ApplyUnderline)

{

Infragistics.Documents.Report.Text.IText tempText = null;

if (tempObj is Infragistics.Documents.Report.IGroup)

{

tempText = ((Infragistics.Documents.Report.
IGroup)tempObj).AddText();

}

if (tempObj is Infragistics.Documents.Report.Flow.IFlow)

{

tempText = ((Infragistics.Documents.Report.Flow.
IFlow)tempObj).AddText();

}

tempText.Style =
new Infragistics.Documents.Report.Text.Style(f, b);

tempText.Style.Font.Bold = ApplyBold;

tempText.Style.Font.Italic = ApplyItalic;

tempText.Style.Font.Underline = ApplyUnderline;

tempText.AddContent(TextToAdd);

if (tempObj is Infragistics.Documents.Report.IGroup)

{

((Infragistics.Documents.Report.
IGroup)tempObj).Width = new RelativeWidth(Relative_Width);

}

if (tempObj is Infragistics.Documents.Report.Flow.IFlow)

{

((Infragistics.Documents.Report.Flow.
IFlow)tempObj).Width = new RelativeWidth(Relative_Width);

}

}

 

 

I want to be able to pass in different KINDS of Infragistics objects, like Group or Flow  objects, and "Add Text"  to those objects.

 

 But when I try to call the above, I get an error:

 

Error: A ref or out argument must be an assignable

 

Parents Reply Children
No Data