@ -58,8 +58,8 @@ namespace ICSharpCode.Reports.Addin
@@ -58,8 +58,8 @@ namespace ICSharpCode.Reports.Addin
throw new ArgumentNullException ( "graphics" ) ;
}
Rectangle rect = new Rectangle ( this . ClientRectangle . Left , this . ClientRectangle . Top ,
this . ClientRectangle . Right - 1 ,
this . ClientRectangle . Bottom - 1 ) ;
this . ClientRectangle . Right - 1 ,
this . ClientRectangle . Bottom - 1 ) ;
base . DrawControl ( graphics ) ;
if ( this . Image ! = null ) {
@ -77,7 +77,9 @@ namespace ICSharpCode.Reports.Addin
@@ -77,7 +77,9 @@ namespace ICSharpCode.Reports.Addin
[EditorAttribute ( typeof(FileNameEditor), typeof(UITypeEditor) ) ]
public string ImageFileName {
get { return imageFileName ; }
set { imageFileName = value ; }
set { imageFileName = value ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.BaseImage > {0}" , this . ImageFileName ) ) ;
}
}
@ -94,13 +96,61 @@ namespace ICSharpCode.Reports.Addin
@@ -94,13 +96,61 @@ namespace ICSharpCode.Reports.Addin
return b ;
}
private Image LoadImage ( )
{
try {
Image im ;
Image im = null ;
// string absFileName = this.AbsoluteFileName;
this . relativeFileName = FileUtility . GetRelativePath ( this . ReportFileName , this . ImageFileName ) ;
// absFileName = FileUtility.GetAbsolutePath (this.relativeFileName,this.ImageFileName);
// System.Diagnostics.Trace.WriteLine("-----");
// System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage ReportFN > {0}",this.reportFileName));
// System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage IamgeFN > {0}",this.ImageFileName));
// System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage rel neu s3 > {0}",this.relativeFileName));
// System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage from absolute > {0}",this.AbsoluteFileName));
// System.Diagnostics.Trace.WriteLine("-----");
string absFileName = this . AbsoluteFileName ;
if ( ! String . IsNullOrEmpty ( absFileName ) & & File . Exists ( absFileName ) ) {
im = Image . FromFile ( absFileName ) ;
} else {
im = BaseImageItem . ErrorBitmap ( base . Size ) ;
}
if ( im = = null ) {
string str = String . Format ( CultureInfo . InvariantCulture ,
"Unable to Load {0}" , imageFileName ) ;
throw new ReportException ( str ) ;
}
return im ;
} catch ( System . OutOfMemoryException ) {
throw ;
} catch ( System . IO . FileNotFoundException ) {
throw ;
}
}
private Image old_LoadImage ( )
{
try {
Image im = null ;
string absFileName = this . AbsoluteFileName ;
if ( ! String . IsNullOrEmpty ( absFileName ) & & File . Exists ( absFileName ) ) {
System . Diagnostics . Trace . WriteLine ( "-----" ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.LoadImage > {0}" , absFileName ) ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.LoadImage ReportFN > {0}" , this . reportFileName ) ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.LoadImage IamgeFN > {0}" , this . ImageFileName ) ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.LoadImage IamgeFN > {0}" , this . RelativeFileName ) ) ;
// string s1 = FileUtility.GetRelativePath(this.reportFileName,this.ImageFileName);
string s2 = FileUtility . GetRelativePath ( this . ImageFileName , this . ReportFileName ) ;
string s3 = FileUtility . GetAbsolutePath ( s2 , this . ImageFileName ) ;
// System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage s1 > {0}",s1));
//System.Diagnostics.Trace.WriteLine(String.Format("<ADDIN.LoadImage s2 > {0}",s2));
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.LoadImage from absolute s3 > {0}" , s3 ) ) ;
System . Diagnostics . Trace . WriteLine ( "-----" ) ;
if ( ! String . IsNullOrEmpty ( absFileName ) & & File . Exists ( absFileName ) ) {
im = Image . FromFile ( this . AbsoluteFileName ) ;
} else {
im = BaseImageItem . ErrorBitmap ( base . Size ) ;
@ -111,6 +161,7 @@ namespace ICSharpCode.Reports.Addin
@@ -111,6 +161,7 @@ namespace ICSharpCode.Reports.Addin
throw new ReportException ( str ) ;
}
return im ;
} catch ( System . OutOfMemoryException ) {
throw ;
} catch ( System . IO . FileNotFoundException ) {
@ -175,10 +226,12 @@ namespace ICSharpCode.Reports.Addin
@@ -175,10 +226,12 @@ namespace ICSharpCode.Reports.Addin
[XmlIgnoreAttribute]
[Category("Image")]
[Browsable(false)]
// [Browsable(false)]
public string ReportFileName {
get { return reportFileName ; }
set { reportFileName = value ; }
get { return Path . GetFullPath ( reportFileName ) ; }
set { reportFileName = value ;
System . Diagnostics . Trace . WriteLine ( "" ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.ImageItem> Filename {0}" , Path . GetFullPath ( this . reportFileName ) ) ) ; }
}
@ -186,19 +239,25 @@ namespace ICSharpCode.Reports.Addin
@@ -186,19 +239,25 @@ namespace ICSharpCode.Reports.Addin
// [Browsable(false)]
public string RelativeFileName {
get { return relativeFileName ; }
set { relativeFileName = value ; }
set { relativeFileName = value ;
System . Diagnostics . Trace . WriteLine ( "" ) ;
System . Diagnostics . Trace . WriteLine ( String . Format ( "<ADDIN.RelativeFilenamee > {0}" , this . relativeFileName ) ) ;
}
}
// [XmlIgnoreAttribute]
[Category("Image")]
[Browsable(false)]
// [Category("Image")]
// [Browsable(false)]
public string AbsoluteFileName
{
get {
string p1 = Path . GetDirectoryName ( this . reportFileName ) ;
string p2 = Path . GetFullPath ( relativeFileName ) ;
string s = FileUtility . GetRelativePath ( p1 , p2 ) ;
string absolute = FileUtility . GetAbsolutePath ( reportFileName , imageFileName ) ;
if ( File . Exists ( absolute ) ) {
return absolute ;
}
if ( ! string . IsNullOrEmpty ( relativeFileName ) ) {
string testFileName = FileUtility . NormalizePath ( Path . Combine ( Path . GetDirectoryName ( this . reportFileName ) , this . relativeFileName ) ) ;
if ( File . Exists ( testFileName ) ) {
@ -275,6 +334,9 @@ namespace ICSharpCode.Reports.Addin
@@ -275,6 +334,9 @@ namespace ICSharpCode.Reports.Addin
prop = props . Find ( "RelativeFileName" , true ) ;
allProperties . Add ( prop ) ;
prop = props . Find ( "AbsoluteFileName" , true ) ;
allProperties . Add ( prop ) ;
prop = props . Find ( "ColumnName" , true ) ;
allProperties . Add ( prop ) ;