How to mark part of the image that appear on my application ?
-
Hi, I'm using picturebox to show some images that my application hold. I want to mark with some square part of my image ( mark in the code ). How can i do it ? Thanks. P.S I'm using simple winform (not WPF)
You'll need to create a watermarked version of the
Image
before setting it into thePictureBox
control. /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Hi, I'm using picturebox to show some images that my application hold. I want to mark with some square part of my image ( mark in the code ). How can i do it ? Thanks. P.S I'm using simple winform (not WPF)
Maybe you want something like the following:
Graphics g = Graphics.FromImage(pb.Image); // Assume pb is your PictureBox
g.DrawRectangle(Pens.Red, pbleft, pbtop, pbwidth, pbheight); // Draw red rectangle in your image.
g.Dispose();This will draw a red rectangle in your image. Is that what you want?
-
Maybe you want something like the following:
Graphics g = Graphics.FromImage(pb.Image); // Assume pb is your PictureBox
g.DrawRectangle(Pens.Red, pbleft, pbtop, pbwidth, pbheight); // Draw red rectangle in your image.
g.Dispose();This will draw a red rectangle in your image. Is that what you want?
I don't think the PictureBox will even be aware you did that. You would have to reload the image or otherwise signal it about the change. BTW: I think PictureBoxes are crap anyway, one should not even try and do such complex :-D things to them. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
I don't think the PictureBox will even be aware you did that. You would have to reload the image or otherwise signal it about the change. BTW: I think PictureBoxes are crap anyway, one should not even try and do such complex :-D things to them. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.