|
Thanks for the correction.
I've used up all my sick days, so today I'm calling in dead.
|
|
|
|
|
What would be the easiest way of drawing rectangles or other shapes onto a picture box using the mouse?
Just like in MS Paint.
|
|
|
|
|
this[^] might help
While (true) { Human.isLearnable = true; }
|
|
|
|
|
No, not suitable for your question but it's obvious!
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Or maybe this[^]
While (true) { Human.isLearnable = true; }
|
|
|
|
|
|
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!
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.
|
|
|
|
|
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; }
|
|
|
|
|
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?
|
|
|
|
|
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
|
|
|
|
|
|
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.
|
|
|
|
|
how can i show a caret inside the listbox, perhaps a horinontally in between the listbox items.
|
|
|
|
|
netJP12L wrote: perhaps a horinontally
WTF! Stop making up words please. It's urgent.
led mike
|
|
|
|
|
dude...you got to take it easy. Where do you see the Urgent.
|
|
|
|
|
You can't with the standard ListBox. Google for editable listbox c#[^] and you're bound to find something.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I found nothing....they are telling how can you make an editable listbox. I am controlling the listbox paint method but couldn't find the right direction how to add a caret.
Is that even possible with listview.
|
|
|
|
|
why else would you want a caret except to show the current text insertion point i.e an editable listbox?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I want to add item depending on the caret position. for instance if the caret is under the 2nd listitem then I would just let user to add item under it if caret is under the 3rd item then user can add listbox item under it
|
|
|
|
|
I'm looking for a way to make it possible for the user to move a control on the form (or let's say inside a panel) during runtime by clicking and dragging with the mouse. Also, I'd like for the user to be able to resize the control by clicking on the edges and dragging.
Could someone point me to an article on how to do this perhaps or even explain the key principles in this thread please?
I suppose it's almost like creating a runtime form editor but I have no need to add controls at runtime. I just want to be able to resize and move one control that will already be on the form.
|
|
|
|
|
I think you'll need to capture mouse down, mouse move and mouse up events on the controls and set their Location or Size properties accordingly. To display handles on them you'll need to override their OnPaint methods.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
For resize controls, u can change the size of control:
control.height = x
control.weight = y
& for move its, u can change the location of its:
control.left = X
control.top = Y
u must write these code to event that u want (for example mouse click btn)...
|
|
|
|