Click here to Skip to main content
15,888,283 members
Home / Discussions / C#
   

C#

 
AnswerRe: Drawing rectangles - with the mouse. Pin
Pedram Behroozi6-Oct-08 13:55
Pedram Behroozi6-Oct-08 13:55 
GeneralRe: Drawing rectangles - with the mouse. Pin
dennycrane6-Oct-08 13:56
dennycrane6-Oct-08 13:56 
GeneralRe: Drawing rectangles - with the mouse. Pin
Pedram Behroozi6-Oct-08 14:03
Pedram Behroozi6-Oct-08 14:03 
GeneralRe: Drawing rectangles - with the mouse. Pin
dennycrane6-Oct-08 21:34
dennycrane6-Oct-08 21:34 
GeneralRe: Drawing rectangles - with the mouse. Pin
Pedram Behroozi7-Oct-08 6:29
Pedram Behroozi7-Oct-08 6:29 
AnswerRe: Drawing rectangles - with the mouse. Pin
dan!sh 6-Oct-08 23:26
professional dan!sh 6-Oct-08 23:26 
GeneralRe: Drawing rectangles - with the mouse. Pin
dennycrane7-Oct-08 2:15
dennycrane7-Oct-08 2:15 
GeneralRe: Drawing rectangles - with the mouse. Pin
dan!sh 7-Oct-08 3:24
professional dan!sh 7-Oct-08 3:24 
Its too big of a code to share. Actually its all mixed with lot of other code that I use for drawing other stuff. I can tell bit of logic though.
1. Grab the coordinates at MouseDown
2. On MouseMove draw rectangles calculating the height and width using the graphics object.
3. On MouseUp get the point to find final hieght and width and keep them for using in Paint event.
4. Redraw final rectangle in Paint event.

You can also place a PictureBox identical to final rectangle in case you want to have some events for the rectangle.

"If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be 'meetings'." - Dave Barry

AnswerRe: Drawing rectangles - with the mouse. Pin
Giorgi Dalakishvili7-Oct-08 0:13
mentorGiorgi Dalakishvili7-Oct-08 0:13 
GeneralRe: Drawing rectangles - with the mouse. Pin
dennycrane7-Oct-08 2:15
dennycrane7-Oct-08 2:15 
Questionhow to show Caret Pin
netJP12L6-Oct-08 9:40
netJP12L6-Oct-08 9:40 
AnswerRe: how to show Caret Pin
led mike6-Oct-08 9:55
led mike6-Oct-08 9:55 
GeneralRe: how to show Caret Pin
netJP12L6-Oct-08 10:13
netJP12L6-Oct-08 10:13 
AnswerRe: how to show Caret Pin
DaveyM696-Oct-08 10:06
professionalDaveyM696-Oct-08 10:06 
GeneralRe: how to show Caret Pin
netJP12L6-Oct-08 10:18
netJP12L6-Oct-08 10:18 
GeneralRe: how to show Caret Pin
DaveyM696-Oct-08 10:34
professionalDaveyM696-Oct-08 10:34 
GeneralRe: how to show Caret Pin
netJP12L6-Oct-08 11:58
netJP12L6-Oct-08 11:58 
QuestionMoving & resizing controls at runtime Pin
Dewald6-Oct-08 9:31
Dewald6-Oct-08 9:31 
AnswerRe: Moving & resizing controls at runtime Pin
DaveyM696-Oct-08 10:09
professionalDaveyM696-Oct-08 10:09 
AnswerRe: Moving & resizing controls at runtime Pin
Hossein Afyuoni6-Oct-08 10:13
Hossein Afyuoni6-Oct-08 10:13 
GeneralRe: Moving & resizing controls at runtime Pin
netJP12L6-Oct-08 10:54
netJP12L6-Oct-08 10:54 
AnswerRe: Moving & resizing controls at runtime Pin
Pedram Behroozi6-Oct-08 11:24
Pedram Behroozi6-Oct-08 11:24 
QuestionDeserialize old versions Pin
eggsovereasy6-Oct-08 8:42
eggsovereasy6-Oct-08 8:42 
AnswerRe: Deserialize old versions Pin
Mark Salsbery6-Oct-08 8:47
Mark Salsbery6-Oct-08 8:47 
GeneralRe: Deserialize old versions Pin
eggsovereasy6-Oct-08 10:47
eggsovereasy6-Oct-08 10:47 

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.