/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="SourceFile"> /// <see cref="System.String"/> containing the full file path to the source image /// </param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the destination size instructions /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(string SourceFile, ScalingOptions Option, Size DestinationSize) { Image imgThumbnail = null; if (File.Exists(SourceFile)) { using (Bitmap bmpSource = new Bitmap(SourceFile)) imgThumbnail = CreateThumbnailImage(bmpSource, Option, DestinationSize); } return(imgThumbnail); }
private static void OnExecutePrint(object sender, ExecutedRoutedEventArgs args) { ScalingOptions option = ScalingOptions.NoScaling; if (args.Parameter != null) { option = GetScaling(args.Parameter.ToString()); } GridTreeControl dataGrid = args.Source as GridTreeControl; dataGrid.Model.ActiveGridView.ScalingOptions = option; dataGrid.Print(); }
/// <summary> /// Sets the scaling option to the option passed using the Option argument /// </summary> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling option to set /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the size of the detination thumbnail /// </param> /// <remarks> /// The DestinationSize argument is only used when the scaling option <see /// cref="HexMaster.Helper.ScalingOptions.FixedSize"/> is passed. /// </remarks> /// <exception cref="System.ArgumentException"> /// gets thrown when the Option argument was set to ScalingOptions.FixedSize, and no /// Destination size was passed /// </exception> public void SetScalingOption(ScalingOptions Option, Size DestinationSize) { if ((Option == ScalingOptions.FixedSize) && ((DestinationSize == null) || (DestinationSize == Size.Empty))) { throw new ArgumentException("If you set the ScalingOption to ScalingOptions.FixedSize, you need to provide a valid destination size", "DestinationSize"); } if (Option == ScalingOptions.FixedSize) { m_DestinationSize = DestinationSize; } m_ScalingOption = Option; }
public static dynamic GetTSObject(ScalingOptions dynEnum) { var tsType = TSActivator.CreateInstance("Tekla.Structures.Drawing.ScalingOptions").GetType(); switch (dynEnum) { case ScalingOptions.NoScaling: return(System.Enum.Parse(tsType, "NoScaling")); case ScalingOptions.ScaleToFit: return(System.Enum.Parse(tsType, "ScaleToFit")); default: throw new DynamicAPIException(dynEnum.ToString() + "- enum value is not implemented"); } }
private static void OnExecuteShowPrintDialog(object sender, ExecutedRoutedEventArgs args) { ScalingOptions option = ScalingOptions.NoScaling; if (args.Parameter != null) { option = GetScaling(args.Parameter.ToString()); } GridDataControl dataGrid = args.Source as GridDataControl; dataGrid.ShowPrintDialog((p) => { p.ScalingOptions = option; // p.ShowDialog(); }); }
public Image CreateFromBase64String(string ImageBase64String, ScalingOptions Option, Size DestinationSize) { Image imgThumbnail = null; if (!string.IsNullOrEmpty(ImageBase64String)) { byte[] bytes = Convert.FromBase64String(ImageBase64String); using (MemoryStream ms = new MemoryStream(bytes)) { using (Bitmap bmpSource = new System.Drawing.Bitmap(ms)) { imgThumbnail = CreateThumbnailImage(bmpSource, Option, DestinationSize); } } } return(imgThumbnail); }
private static void OnExecuteShowPrintDialog(object sender, ExecutedRoutedEventArgs args) { ScalingOptions option = ScalingOptions.NoScaling; if (args.Parameter != null) { option = GetScaling(args.Parameter.ToString()); } GridControl grid = args.Source as GridControl; grid.ShowPrintDialog((p) => { p.ScalingOptions = option; //ScalingOptions.FitAllColumnsonOnePage; grid.ScalingOptions = option; p.ShowDialog(); }); }
private static ScalingOptions GetScaling(string selectedItem) { ScalingOptions option = ScalingOptions.NoScaling; switch (selectedItem) { case "NoScaling": option = ScalingOptions.NoScaling; break; case "FitAllColumnsonOnePage": option = ScalingOptions.FitAllColumnsonOnePage; break; case "FitAllRowsonOnePage": option = ScalingOptions.FitAllRowsonOnePage; break; case "FitGridonOnePage": option = ScalingOptions.FitGridonOnePage; break; } return(option); }
public Image CreateFromBase64String(string ImageBase64String, ScalingOptions Option) { return(CreateFromBase64String(ImageBase64String, Option, m_DestinationSize)); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="SourceFile"> /// <see cref="System.String"/> containing the full file path to the source image /// </param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(string SourceFile, ScalingOptions Option) { return(CreateThumbnailImage(SourceFile, Option, m_DestinationSize)); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="Source"><see cref="System.Drawing.Bitmap"/> containing te source image</param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the destination size instructions /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(Bitmap Source, ScalingOptions Option, Size DestinationSize) { SetScalingOption(Option, DestinationSize); return CreateThumbnail(Source); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="Source"><see cref="System.Drawing.Bitmap"/> containing te source image</param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(Bitmap Source, ScalingOptions Option) { return(CreateThumbnailImage(Source, Option, m_DestinationSize)); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="Source"><see cref="System.Drawing.Bitmap"/> containing te source image</param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the destination size instructions /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(Bitmap Source, ScalingOptions Option, Size DestinationSize) { SetScalingOption(Option, DestinationSize); return(CreateThumbnail(Source)); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="Source"><see cref="System.Drawing.Bitmap"/> containing te source image</param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(Bitmap Source, ScalingOptions Option) { return CreateThumbnailImage(Source, Option, m_DestinationSize); }
/// <summary> /// Sets the scaling option to the option passed using the Option argument /// </summary> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling option to set /// </param> public void SetScalingOption(ScalingOptions Option) { SetScalingOption(Option, Size.Empty); }
/// <summary> /// Sets the scaling option to the option passed using the Option argument /// </summary> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling option to set /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the size of the detination thumbnail /// </param> /// <remarks> /// The DestinationSize argument is only used when the scaling option <see /// cref="HexMaster.Helper.ScalingOptions.FixedSize"/> is passed. /// </remarks> /// <exception cref="System.ArgumentException"> /// gets thrown when the Option argument was set to ScalingOptions.FixedSize, and no /// Destination size was passed /// </exception> public void SetScalingOption(ScalingOptions Option, Size DestinationSize) { if ((Option == ScalingOptions.FixedSize) && ((DestinationSize == null) || (DestinationSize == Size.Empty))) throw new ArgumentException("If you set the ScalingOption to ScalingOptions.FixedSize, you need to provide a valid destination size", "DestinationSize"); if (Option == ScalingOptions.FixedSize) m_DestinationSize = DestinationSize; m_ScalingOption = Option; }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="SourceFile"> /// <see cref="System.String"/> containing the full file path to the source image /// </param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(string SourceFile, ScalingOptions Option) { return CreateThumbnailImage(SourceFile, Option, m_DestinationSize); }
/// <summary> /// Creates a thumbnail image /// </summary> /// <param name="SourceFile"> /// <see cref="System.String"/> containing the full file path to the source image /// </param> /// <param name="Option"> /// <see cref="HexMaster.Helper.ScalingOptions"/> containing the scaling options flag /// </param> /// <param name="DestinationSize"> /// <see cref="System.Drawing.Size"/> containing the destination size instructions /// </param> /// <returns> /// <see cref="System.Drawing.Image"/> containing the result of the thumbnail creation /// </returns> public Image CreateThumbnailImage(string SourceFile, ScalingOptions Option, Size DestinationSize) { Image imgThumbnail = null; if (File.Exists(SourceFile)) { using (Bitmap bmpSource = new Bitmap(SourceFile)) imgThumbnail = CreateThumbnailImage(bmpSource); } return imgThumbnail; }