Greetings...
hope all are fine..
i am trying to making a image effect.
Let say:
there is 3 picture box
when i click on a button picture1 drawn on picture3
now to do the effect again i set pic3=pic2
and click the button again. it's drawn the pic on on pic3
but the issue is it also change pic2 to pic1 (or may be to pic3) why
so, please download the attached file and help me out. I am stuck..
i had experience that many one don't want to download attachment for them: (but better if you download the vb.net source files)
Steps:
1. Create a new vb.net project (winform)
2. Place 3 Picturebox (size Mode Property to stretch image)
3. Now Add 3 Different Picture On The Picture boxes
3. Add A Button
Now Use Bellow Source Code:
Now just run and press the button 2 time (better if you gap few sec)Code:Public Class Form1 Dim bmp1 As Bitmap Dim bmp2 As Bitmap Dim grpDst As Graphics Dim FromRect As Rectangle Dim ToRect As Rectangle Private Sub cmd1_Click(sender As System.Object, e As System.EventArgs) Handles cmd1.Click bmp1 = New Bitmap(PictureBox1.Image) bmp2 = New Bitmap(PictureBox2.Image) grpDst = Graphics.FromImage(PictureBox3.Image) SDrawTest() PictureBox3.Image = PictureBox2.Image REM to load another image on pic3 to set pic 1 again PictureBox2.Refresh() PictureBox3.Refresh() End Sub Sub SDrawTest() FromRect = New Rectangle(0, 0, bmp1.Width, bmp1.Height) ToRect = New Rectangle(0, 0, bmp1.Width, bmp1.Height) grpDst.DrawImage(bmp1, ToRect, FromRect, GraphicsUnit.Pixel) PictureBox3.Refresh() System.Threading.Thread.Sleep(1000) REM to show what the effect does End Sub End Class
on 2nd run picture 2 changes to picture 1 (or may be 3) i don't know
but why?
i just want to show/draw the source image on target image
(May main gold is manipulating vb6 PaintPicture method)
any help would be highly appreciated
best regards





Reply With Quote
