Click here to Skip to main content
15,919,879 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pressing the X Button Pin
TheMajorRager5-Dec-05 10:12
TheMajorRager5-Dec-05 10:12 
GeneralRe: Pressing the X Button Pin
J4amieC5-Dec-05 21:56
J4amieC5-Dec-05 21:56 
GeneralRe: Pressing the X Button Pin
TheMajorRager6-Dec-05 6:26
TheMajorRager6-Dec-05 6:26 
QuestionEasy forms question Pin
melanieab5-Dec-05 8:40
melanieab5-Dec-05 8:40 
AnswerRe: Easy forms question Pin
Dan Neely5-Dec-05 9:11
Dan Neely5-Dec-05 9:11 
AnswerRe: Easy forms question Pin
Alvaro Mendez5-Dec-05 9:41
Alvaro Mendez5-Dec-05 9:41 
QuestionListview column resizing problem Pin
Dan Neely5-Dec-05 8:27
Dan Neely5-Dec-05 8:27 
QuestionIs it possible to remove existing graphics from an image? Pin
Gulfraz Khan5-Dec-05 6:30
Gulfraz Khan5-Dec-05 6:30 
Hi
I am trying to draw a rectangle over an existing image by using the following code (pb is the PictureBox and has an image)

Graphics oGraphics  = Graphics.FromImage(pb.Image);<br />
oGraphics.DrawRectangle(new Pen(Color.Red, 2), new Rectangle(5, 5, 300, 300));<br />
pb.Refresh();



The problem comes when I want to draw another rectangle (at a different location) and I can't remove/clear the existing rectangle before drawing the new one.
Is there any way I can remove the existing drawn rectangle?
I don't want to use the pb.CreateGraphics() b/c the drawing is not consistent when this method is used.
I am using the FromImage() method b/c later I want to resize (zoom) or rotate the image with drawn rectangle and It won't require any further coding for rotating and resizing the rectangle.

I tried reload the Image again, but large images take to much time to load, so I want to avoid the Image reloading.
Please help!
AnswerRe: Is it possible to remove existing graphics from an image? Pin
mav.northwind5-Dec-05 7:12
mav.northwind5-Dec-05 7:12 
AnswerRe: Is it possible to remove existing graphics from an image? Pin
Robert Rohde5-Dec-05 7:13
Robert Rohde5-Dec-05 7:13 
AnswerRe: Is it possible to remove existing graphics from an image? Pin
dnewmon5-Dec-05 7:22
dnewmon5-Dec-05 7:22 
GeneralRe: Is it possible to remove existing graphics from an image? Pin
Gulfraz Khan7-Dec-05 2:28
Gulfraz Khan7-Dec-05 2:28 
QuestionDateTime Range Pin
lior654#hotmail.com5-Dec-05 4:36
lior654#hotmail.com5-Dec-05 4:36 
AnswerRe: DateTime Range Pin
dnewmon5-Dec-05 6:58
dnewmon5-Dec-05 6:58 
GeneralRe: DateTime Range Pin
lior654#hotmail.com5-Dec-05 18:23
lior654#hotmail.com5-Dec-05 18:23 
GeneralRe: DateTime Range Pin
dnewmon6-Dec-05 7:21
dnewmon6-Dec-05 7:21 
Questiontypedef in c# Pin
Sasuko5-Dec-05 4:26
Sasuko5-Dec-05 4:26 
AnswerRe: typedef in c# Pin
ThaddParker5-Dec-05 4:32
ThaddParker5-Dec-05 4:32 
AnswerRe: typedef in c# Pin
J4amieC5-Dec-05 4:42
J4amieC5-Dec-05 4:42 
GeneralRe: typedef in c# Pin
Curtis Schlak.5-Dec-05 5:51
Curtis Schlak.5-Dec-05 5:51 
GeneralRe: typedef in c# Pin
mav.northwind5-Dec-05 7:04
mav.northwind5-Dec-05 7:04 
GeneralRe: typedef in c# Pin
dnewmon5-Dec-05 7:29
dnewmon5-Dec-05 7:29 
GeneralRe: typedef in c# Pin
Curtis Schlak.5-Dec-05 9:23
Curtis Schlak.5-Dec-05 9:23 
QuestionTrying to encrypt a string Pin
Rich Poulin5-Dec-05 3:58
Rich Poulin5-Dec-05 3:58 
AnswerRe: Trying to encrypt a string Pin
Colin Angus Mackay5-Dec-05 4:23
Colin Angus Mackay5-Dec-05 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.