示例#1
0
        /// <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);
        }
示例#2
0
        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();
        }
示例#3
0
        /// <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");
            }
        }
示例#5
0
        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();
            });
        }
示例#6
0
        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);
        }
示例#7
0
        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();
            });
        }
示例#8
0
        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);
        }
示例#9
0
 public Image CreateFromBase64String(string ImageBase64String, ScalingOptions Option)
 {
     return(CreateFromBase64String(ImageBase64String, Option, m_DestinationSize));
 }
示例#10
0
 /// <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));
 }
示例#11
0
 /// <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);
 }
示例#12
0
 /// <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));
 }
示例#13
0
 /// <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));
 }
示例#14
0
 /// <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);
 }
示例#15
0
 /// <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);
 }
示例#16
0
        /// <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;
        }
示例#17
0
 /// <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);
 }
示例#18
0
 /// <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);
 }
示例#19
0
 /// <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;
 }