Click here to Skip to main content
15,850,750 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
'Create a Graphics object
Dim g As Graphics = Me.CreateGraphics()
g.Clear(Me.BackColor)
'Create a Bitmap object
Dim curBitmap As New Bitmap(PictureBox1.Image )
'Color matrix elements
Dim ptsArray As Single()() = {New Single() {1, 0, 0, 0, 0}, New Single() {0, 1, 0, 0, 0}, New Single() {0, 0, 1, 0, 0}, New Single() {0, 0, 0, 1, 0}, New Single() {41.22F, 29.0F, 0.0F, 0.0F, 1}}
'Create a ColorMatrix object
Dim clrMatrix As New ColorMatrix(ptsArray)
'Create image attributes
Dim imgAttribs As New ImageAttributes()
'Set color matrix
imgAttribs.SetColorMatrix(clrMatrix, ColorMatrixFlag.[Default], ColorAdjustType.[Default])
'Draw image with no effects
g.DrawImage(curBitmap, 0, 0, 200, 200)
'Draw image with image attributes
g.DrawImage(curBitmap, New Rectangle(205, 0, 200, 200), 0, 0, curBitmap.Width, curBitmap.Height, _
 GraphicsUnit.Pixel, imgAttribs)
'Dispose of objects
curBitmap.Dispose()
g.Dispose()




My code here convert an image to a new color from Picturebox1 now my question is how can i put the new image in the Picturebox2 because my code here shows only in a new rectangle
Posted

1 solution

You put an image in PictureBox using this property: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image(v=vs.110).aspx[^].

Usually, if you need to do some browsing in PictureBox, as opposed to putting available images to it, it means that you should not use this class at all. Please see my past answers:
Append a picture within picturebox[^],
draw a rectangle in C#[^],
How do I clear a panel from old drawing[^].

See also:
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
How to speed up my vb.net application?[^],
Drawing Lines between mdi child forms[^],
Zoom image in C# .net mouse wheel[^].

I hope you are getting the idea.

—SA
 
Share this answer
 
Comments
Crixalis Paul 16-Dec-13 17:47pm    
Sir Im sorry I didnt get your point even i tried. I just want to put the new colored image in the right position and thats in the picturebox
Sergey Alexandrovich Kryukov 16-Dec-13 18:15pm    
Did you read the referenced answers? If you did, what part didn't you get, exactly?
—SA
Crixalis Paul 16-Dec-13 23:10pm    
Sir Everything :(
Sergey Alexandrovich Kryukov 17-Dec-13 3:10am    
There cannot be everything. If I try to explain everything, I'd start over, but if I start over, chances are, I'd write the same thing. :-)
—SA

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