Exemplo n.º 1
0
            static public KnobImageUtility Create(string file, int count, int space)
            {
                KnobImageUtility kiu = null;

                try { kiu = new KnobImageTool.KnobImageUtility(file, count, space); } catch { }
                return(kiu);
            }
Exemplo n.º 2
0
 static IEnumerable <Image> EnumerateExternalNumberedImages(KnobImageUtility k)
 {
     for (int i = 1; i <= k.ImageCount; i++)
     {
         string path     = string.Format(@"{0}\{1:000#}{2}", k.InitialFileInfo.DirectoryName, i, k.InitialFileInfo.Extension);
         Image  newImage = Bitmap.FromFile(path);
         Debug.Print(path);
         yield return(newImage);
     }
 }
Exemplo n.º 3
0
        void RefreshKnob()
        {
            ImageUtil = KnobImageUtility.Create(ImageReferencePath, (int)tCount.Value, (int)tSpace.Value);
            if (ImageUtil == null)
            {
                return;
            }
//			this.knob1.SuspendLayout();
            this.knob1.Length    = ImageUtil.ImageCount;
            this.knob1.Offset    = ImageUtil.ImageSpace;
            this.knob1.Width     = ImageUtil.ImageWidth;
            this.knob1.Height    = ImageUtil.ImageHeight;
            this.knob1.KnobImage = ImageUtil.SelectedImage;
//			this.knob1.ResumeLayout(true);
            this.knob1.Invalidate();
        }
Exemplo n.º 4
0
            /// <summary>
            /// A one time merger of images to a single image.
            /// </summary>
            static public void Draw(KnobImageUtility k)
            {
                if (k.SelectedImage != null)
                {
                    k.SelectedImage.Dispose();
                    k.SelectedImage = null;
                }
                using (Image img = Bitmap.FromFile(k.InitialFileInfo.FullName))
                {
                    k.ImageWidth  = img.Width;
                    k.ImageHeight = img.Height;
                }
                int newWidth = k.ImageWidth * k.ImageCount + (k.ImageSpace * (k.ImageCount - 1));

                k.SelectedImage = new Bitmap(newWidth, k.ImageHeight, PixelFormat.Format32bppArgb);

                int counter = 0;

                using (Graphics g = Graphics.FromImage(k.SelectedImage))
                {
                    g.Clear(Color.Transparent);
                    foreach (Image image in EnumerateExternalNumberedImages(k))
                    {
                        using (image)
                        {
                            if (k.Direction == FlowDirection.TopDown)
                            {
                                g.DrawImage(image, new Point(counter, 0));
                            }
                            if (k.Direction == FlowDirection.LeftToRight)
                            {
                                g.DrawImage(image, new Point(0, counter));
                            }
                            counter += k.ImageWidth + k.ImageSpace;
                        }
                    }
                }
            }
Exemplo n.º 5
0
 void RefreshKnob(string imagePath)
 {
     ImageReferencePath = imagePath;
     ImageUtil          = null;
 }
Exemplo n.º 6
0
 static IEnumerable<Image> EnumerateExternalNumberedImages(KnobImageUtility k)
 {
     for (int i = 1; i <= k.ImageCount; i++)
     {
         string path = string.Format( @"{0}\{1:000#}{2}", k.InitialFileInfo.DirectoryName, 	i, k.InitialFileInfo.Extension );
         Image newImage = Bitmap.FromFile(path);
         Debug.Print(path);
         yield return newImage;
     }
 }
Exemplo n.º 7
0
            /// <summary>
            /// A one time merger of images to a single image.
            /// </summary>
            public static void Draw(KnobImageUtility k)
            {
                if (k.SelectedImage!=null)
                {
                    k.SelectedImage.Dispose();
                    k.SelectedImage = null;
                }
                using (Image img = Bitmap.FromFile(k.InitialFileInfo.FullName))
                {
                    k.ImageWidth = img.Width;
                    k.ImageHeight = img.Height;
                }
                int newWidth = k.ImageWidth * k.ImageCount + (k.ImageSpace * (k.ImageCount-1));
                k.SelectedImage = new Bitmap( newWidth, k.ImageHeight, PixelFormat.Format32bppArgb );

                int counter = 0;

                using (Graphics g = Graphics.FromImage(k.SelectedImage))
                {
                    g.Clear(Color.Transparent);
                    foreach (Image image in EnumerateExternalNumberedImages(k))
                    {
                        using (image)
                        {
                            if (k.Direction == FlowDirection.TopDown) g.DrawImage( image , new Point( counter, 0 ) );
                            if (k.Direction == FlowDirection.LeftToRight) g.DrawImage( image , new Point( 0, counter ) );
                            counter += k.ImageWidth+k.ImageSpace;
                        }
                    }
                }
            }
Exemplo n.º 8
0
 void RefreshKnob()
 {
     ImageUtil = KnobImageUtility.Create(ImageReferencePath,(int)tCount.Value,(int)tSpace.Value);
     if (ImageUtil==null) return;
     //			this.knob1.SuspendLayout();
     this.knob1.Length = ImageUtil.ImageCount;
     this.knob1.Offset = ImageUtil.ImageSpace;
     this.knob1.Width = ImageUtil.ImageWidth;
     this.knob1.Height = ImageUtil.ImageHeight;
     this.knob1.KnobImage = ImageUtil.SelectedImage;
     //			this.knob1.ResumeLayout(true);
     this.knob1.Invalidate();
 }
Exemplo n.º 9
0
 void RefreshKnob(string imagePath)
 {
     ImageReferencePath = imagePath;
     ImageUtil = null;
 }