예제 #1
0
        public CustomImage(ImagePanel inicl)
        {
            if (inicl.I == null)
                    return;

                var b = inicl.I as Bitmap;
                if (b == null)
                    return;

                var rect = new Rectangle(0, 0, b.Width, b.Height);
                var x=b.GetPixel(3, 3);
                var bmpData =
                b.LockBits(rect, ImageLockMode.ReadOnly,
                            b.PixelFormat);
                var PF = b.PixelFormat;

                var by = Math.Abs(bmpData.Stride) * b.Height;
                var byl = new byte[by];

                // Copy the RGB values into the array.
                Marshal.Copy(bmpData.Scan0, byl, 0, by);
                b.UnlockBits(bmpData);

                Array = byl;
                Format = bmpData.PixelFormat;
                Height = b.Height;
                Width = b.Width;
                Scan0 = bmpData.Scan0;
                Stride = bmpData.Stride;
        }
예제 #2
0
        public CustomImage(ImagePanel inicl)
        {
            if (inicl.I == null)
            {
                return;
            }

            var b = inicl.I as Bitmap;

            if (b == null)
            {
                return;
            }

            var rect    = new Rectangle(0, 0, b.Width, b.Height);
            var x       = b.GetPixel(3, 3);
            var bmpData =
                b.LockBits(rect, ImageLockMode.ReadOnly,
                           b.PixelFormat);
            var PF = b.PixelFormat;

            var by  = Math.Abs(bmpData.Stride) * b.Height;
            var byl = new byte[by];

            // Copy the RGB values into the array.
            Marshal.Copy(bmpData.Scan0, byl, 0, by);
            b.UnlockBits(bmpData);

            Array  = byl;
            Format = bmpData.PixelFormat;
            Height = b.Height;
            Width  = b.Width;
            Scan0  = bmpData.Scan0;
            Stride = bmpData.Stride;
        }
예제 #3
0
 private bool LoadImage(ref ImagePanel I, String path)
 {
     try
     {
         if (File.Exists(path) == false)
         {
             return(false);
         }
         I.I = Image.FromFile(path);
         I.output.BackgroundImage = I.I;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error loading image:" + ex);
         return(false);
     }
     return(true);
 }
예제 #4
0
        private void LoadImageIntoTabPage(String filenameIN, Image i = null)
        {
            if (string.IsNullOrEmpty(filenameIN) == false && File.Exists(filenameIN) == false)
            {
                return;
            }

            var filename = Calculations.Imageimage + ImagePanels.Count.ToString();

            //create new tabpage and panel
            var newTP = new TabPage(filename);
            var p     = new Panel {
                BackgroundImageLayout = ImageLayout.Zoom, Name = filename, Dock = DockStyle.Fill
            };

            var newICL = new ImagePanel {
                output = p
            };

            if (i != null)
            {
                newICL.I          = i;
                p.BackgroundImage = newICL.I;
            }

            else
            {
                if (LoadImage(ref newICL, filenameIN) == false)
                {
                    return;
                }
            }

            ImagePanels.Add(ImagePanels.Count, newICL);
            maintabcontrol.TabPages.Add(newTP);

            newTP.Controls.Add(p);
        }
예제 #5
0
        private void LoadImageIntoTabPage(String filenameIN, Image i = null)
        {
            if (string.IsNullOrEmpty(filenameIN) == false && File.Exists(filenameIN) == false)
                return;

            var filename = Calculations.Imageimage + ImagePanels.Count.ToString();

            //create new tabpage and panel
            var newTP = new TabPage(filename);
            var p = new Panel { BackgroundImageLayout = ImageLayout.Zoom, Name = filename, Dock = DockStyle.Fill };

            var newICL = new ImagePanel { output = p };

            if (i != null)
            {
                newICL.I = i;
                p.BackgroundImage = newICL.I;
            }

            else
            {
                if (LoadImage(ref newICL, filenameIN) == false)
                    return;
            }

            ImagePanels.Add(ImagePanels.Count, newICL);
            maintabcontrol.TabPages.Add(newTP);

            newTP.Controls.Add(p);
        }
예제 #6
0
 private bool LoadImage(ref ImagePanel I, String path)
 {
     try
     {
         if (File.Exists(path) == false)
             return false;
         I.I = Image.FromFile(path);
         I.output.BackgroundImage = I.I;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error loading image:" + ex);
         return false;
     }
     return true;
 }