private static void ConvertAbsolut2RelativePath(System.Windows.Forms.Control.ControlCollection controls, string fileName) { foreach (Control control in controls) { if (control.Controls.Count > 0) { ConvertAbsolut2RelativePath(control.Controls, fileName); } BaseImageItem baseImageItem = control as BaseImageItem; if (baseImageItem != null) { baseImageItem.ReportFileName = fileName; if (Path.IsPathRooted(baseImageItem.ImageFileName)) { Console.WriteLine("Absolut2RelativePath"); Console.WriteLine("Image Filename {0}", fileName); Console.WriteLine("Image Filename {0}", baseImageItem.ImageFileName); string d = ICSharpCode.Reports.Core.FileUtility.GetRelativePath( Path.GetDirectoryName(fileName), Path.GetDirectoryName(baseImageItem.ImageFileName)); baseImageItem.RelativeFileName = d + Path.DirectorySeparatorChar + Path.GetFileName(baseImageItem.ImageFileName); Console.WriteLine("Rel Filename {0}", baseImageItem.RelativeFileName); } } } }
private void OnComponentChanged(object sender, ComponentChangedEventArgs e) { BaseImageItem item = e.Component as BaseImageItem; if (item != null) { item.ReportFileName = this.loader.ReportModel.ReportSettings.FileName; } bool loading = this.loader != null && this.loader.Loading; LoggingService.Debug("ReportDesignerView: ComponentChanged: " + (e.Component == null ? "<null>" : e.Component.ToString()) + ", Member=" + (e.Member == null ? "<null>" : e.Member.Name) + ", OldValue=" + (e.OldValue == null ? "<null>" : e.OldValue.ToString()) + ", NewValue=" + (e.NewValue == null ? "<null>" : e.NewValue.ToString()) + "; Loading=" + loading + "; Unloading=" + this.unloading); if (!loading && !unloading) { this.MakeDirty(); } MergeFormChanges(); }
private void OnComponentChanged(object sender, ComponentChangedEventArgs e) { // More customization of items can be found in //ICSharpCode.Reports.Addin.ReportRootDesigner BaseImageItem item = e.Component as BaseImageItem; if (item != null) { item.ReportFileName = this.loader.ReportModel.ReportSettings.FileName; } bool loading = this.loader != null && this.loader.Loading; LoggingService.Debug("ReportDesignerView: ComponentChanged: " + (e.Component == null ? "<null>" : e.Component.ToString()) + ", Member=" + (e.Member == null ? "<null>" : e.Member.Name) + ", OldValue=" + (e.OldValue == null ? "<null>" : e.OldValue.ToString()) + ", NewValue=" + (e.NewValue == null ? "<null>" : e.NewValue.ToString()) + "; Loading=" + loading + "; Unloading=" + this.unloading); if (!loading && !unloading) { this.MakeDirty(); } }
private Image LoadImage() { try { Image im = null; string absFileName = this.AbsoluteFileName; if (!String.IsNullOrEmpty(absFileName) && File.Exists(absFileName)) { im = Image.FromFile(absFileName); } else { im = BaseImageItem.ErrorBitmap(base.Size); } return(im); } catch (System.OutOfMemoryException) { throw; } catch (System.IO.FileNotFoundException) { throw; } }