Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello everyone,

Have a problem in manipulating image in Picturebox.
I don't know what term should I use in this, hope someone will understand

This is my code on putting initializing image
VB
ImgViewer.Bmp = New Bitmap(ImgViewer.ImagePath)
ImgViewer.PageNbr = 1
ImgViewer.TotalPage = ImgViewer.Bmp.GetFrameCount(Imaging.FrameDimension.Page)
PictureBox1.Image = ImgViewer.Bmp
ImgViewer.Width = ImgViewer.Bmp.Width
ImgViewer.Height = ImgViewer.Bmp.Height
ImgViewer.Factor = 1
PictureBox1.Width = ImgViewer.Width
PictureBox1.Height = ImgViewer.Height
PictureBox1.MinimumSize = New Size(ImgViewer.Width * 0.01, ImgViewer.Height * 0.01)


My problem is when I'm editeng/changing the picturebox image, the bitmap also changes or vice versa.

Is there a code/syntax that make the ImgViewer.Bmp and PictureBox1.Image that make them independent. Editing one variable can't affect the other. I will use the ImgViewer.Bmp as a original image and PictureBox1.Image will be the processed image (Anti-Aliasing, Rotate, Invert Colors and etc.)

Please Help...
Thanks
Posted
Comments
[no name] 22-Jul-14 8:57am    
"make them independent"... yes there is... simply delete the "PictureBox1.Image = ImgViewer.Bmp" line.
hansoctantan 22-Jul-14 9:09am    
then how can i display the image in picturebox?
[no name] 22-Jul-14 12:49pm    
The exact same way, PictureBox1.Image = someBitmap. I am not seeing the problem here.
_Vitor Garcia_ 22-Jul-14 10:38am    
You could have 2 controls overlayed. One with the original picture, the other with the processed.
hansoctantan 22-Jul-14 13:23pm    
That is a good suggestion, but I'm trying to avoid multiple Bitmaps declaration with same file. I have a sample tiff file that exceed 500 pages, with this I would have a 1000+ pages.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900