How to add vertical lines in a processed image???

May 24 2010 4:48 AM
Hi to everyone,
Congratulation for the great job in this forum.
From previous topic I attained to process an image and have a new size.
In my application(in Extract Image field,see the screen below), i want again to load in a pictureBox (pictureBox4) the resized image-photo from previous pictureBox (pictureBox3) and add crosses(i mean vertical and horizontal lines) but in parallel, to fill the lost space from the previous resized image-photo.
I have already achieved to add horizontal lines but no vertical lines...in my application.
This is the code for horizontal lines:

private void btnAddCrosses_Click(object sender, EventArgs e)
        {  //take the resized photo
            Image source = pictureBox4.Image;
            Bitmap sbitmap = new Bitmap(source);
           
            int height, width, f_width, f_height ;

            height = source.Height ;
            width = source.Width;
            
            //Define the steps(pixels) you want in the textBox
            int step = Convert.ToInt32(textBox2.Text);
            
            //Resizing photo to the first size
            f_width = width + System.Convert.ToInt32(Math.Floor((double)(width / step ))) - 1;
            f_height = height + System.Convert.ToInt32(Math.Floor((double)(height / step))) - 1;

            Bitmap myBitmap = new Bitmap(f_width,f_height);
                
            int xadd, yadd;
            xadd = 0;
            yadd = 0;

            Color scolor;
            for (int x = 0; x < width; x++ )
            {
                xadd = 0;
                yadd = 0;
                for (int y = 0; y < height; y++)
                {
                    if (y % step == 0)
                    {
                        yadd++;
                        myBitmap.SetPixel(x+xadd , y+yadd, Color.White);
                    }
                   
                    else
                    {
                        scolor = sbitmap.GetPixel(x, y);
                        myBitmap.SetPixel(x, y, scolor);
                    }

                }
            }
            pictureBox5.Image = myBitmap;
        }

Also i can provide you with a screenshot of my application, so you can see better what exactly i mean:


http://img179.imageshack.us/i/appfff.jpg/



Thank you in advance for your time...


Answers (1)