Hi,
I'm developing smart device application by using CF1.0 on VS 2003. I need your help. I've a code for drawing objects (Rect, Circle, String, Image) on PictureBox. what my question is how to copy/get Pixels particular part of area and display its in another PictureBox. Please send your suggestion or links.
Thanx.
M. GANESAN

How to get pixels from Picturebox
gabo_uy
Hi,
Thanx for your response. But you said only for PictureBox.Image. My requirement is how to get current view (suppose picturebox has drawing objects like rectangle, circle...) from the picturebox. Please send suggestions.
Thanx.
M. GANESAN
Jandost Khoso
Hi,
Yeah i tried your code. it works for drawing images only not for shapes. PictureBox1.Image this is for get/set bitmap image from/to the picturebox. we can't get bitmap and face error if picturebox has no image. Please send your suggestion.
Thanx.
M. GANESAN
paso
Sorry, You misunderstood my question. I want to copy particular area of a picture box and display its in another picturebox. OK i'm going to explain briefly.
I have two picturebox and one button.
PictureBox1's size is (150,100) and Picturebox2's size is (100,75).
I have written code for drawing some shapes in the first picturebox at picturebox1_paint() event.
Private Sub PictureBox1_Paint(........) Handles PictureBox1.PaintDim g As Graphics = e.Graphics
g.FillEllipse(New SolidBrush(Color.Thistle), 10, 10, 100, 50)
g.DrawString("Welcome", New Font("arial", 15, FontStyle.Bold), New SolidBrush(Color.Black), 20, 25)
g.Dispose()
End Sub
Now my question is when i clik the command button, half part of picturebox1's Snap has to be displayed in the PictureBox2 (i.e first half ellipse with Welc). Please send your suggestion.
Note: According to your code. G = Graphics.FromImage(PictureBox1.Image)
we get an error NullReferenceException if the PictureBox1 has no image but it has some shapes.
Thanx.
M. GANESAN
blue56789
udayan
e.g, I used the following method to draw some shapes :
Dim G As Graphics
G = Graphics.FromImage(PictureBox1.Image)
G.FillRectangle(Brushes.Black, 0, 0, 100, 100)
Euclidez
Take a look at this code, I tested and it worked fine (as you want, EXACTLY)
kastanienreis
Hi,
Thanx
M. GANESAN
maddman
Dim SrcBMP As New Bitmap(PictureBox1.Image)
Dim TrgBMP As New Bitmap(PictureBox2.Image)
TrgBMP.SetPixel(0, 0, TMPBMP.GetPixel(0, 0)
Or if you want to get a region from the first picture then set to the second one :
Dim TmpG As Graphics
TmpG = Graphics.FromImage(PictureBox2.Image)
TmpG.DrawImage(PictureBox1.Image, New Rectangle(0, 0, 50, 50), New Rectangle(200, 200, 50, 50), GraphicsUnit.Pixel)