Drawing rectangles - with the mouse.
-
Hey, make your choice[^] ;)
While (true) { Human.isLearnable = true; }
I looked at both of the links, seems it could be easier.
-
I looked at both of the links, seems it could be easier.
dennycrane wrote:
I looked at both of the links
Did you do that right now? You're amazing! :omg:
dennycrane wrote:
seems it could be easier.
What do you mean? Do you have any idea?
While (true) { Human.isLearnable = true; }
-
No, not suitable for your question but it's obvious!
While (true) { Human.isLearnable = true; }
-
dennycrane wrote:
I looked at both of the links
Did you do that right now? You're amazing! :omg:
dennycrane wrote:
seems it could be easier.
What do you mean? Do you have any idea?
While (true) { Human.isLearnable = true; }
Yes, very simple. Click on a button then on a picturebox and a rectangle would appear.
-
What would be the easiest way of drawing rectangles or other shapes onto a picture box using the mouse? Just like in MS Paint.
I did this using MouseDown, MouseMove, MouseUp and Paint event. And ofcourse a graphics object.
"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
-
What would be the easiest way of drawing rectangles or other shapes onto a picture box using the mouse? Just like in MS Paint.
See this: Draw with Mouse[^]
Giorgi Dalakishvili #region signature My Articles / My Latest Article[^] / My blog[^] #endregion
-
See this: Draw with Mouse[^]
Giorgi Dalakishvili #region signature My Articles / My Latest Article[^] / My blog[^] #endregion
I know how to draw a line and I have that code, I don“t know how to get a rectangle or some other form to show on a picture box.
-
I did this using MouseDown, MouseMove, MouseUp and Paint event. And ofcourse a graphics object.
"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
could you give some examples?
-
could you give some examples?
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
-
Yes, very simple. Click on a button then on a picturebox and a rectangle would appear.
Well, it's too simple. I thought you said "like MS Paint" (actually you did!). However for your reason you should call PictureBox_Paint in Button_Click (be careful of parameters) and use e.Graphics.DrawRectangle(Pen pen, int x, int y, int width, int height) (+2 overload(s)) to draw a rectangle. Or you have something else to say? :^)
While (true) { Human.isLearnable = true; }