|
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)...
|
|
|
|
|
I guess the this user wants to know how can he display handles around the control
|
|
|
|
|
I created a simple search in Google and I found this[^] for resizing and this[^] for dragging in less than a minute. Always try Google, MSDN and CP articles first, they're more and more and even more faster. Maybe you should visit here[^] before you post your post here[^]
|
|
|
|
|
I have a program that I didn't write, but maintain. Recently the assembly version was incremented to 1.0.1.0 and when it tries to load serialized objects (binary formatter) that were made with 1.0.0.0 I get an InvalidCastException. There was nothing changed in these on the objects themselves so there should be really need to be a cast.
|
|
|
|
|
|
Thanks for the reply.
Because there was no actual change in the class (just version) I was able to just change the Version number listed in the binary file to the new version and it cast fine from there on out.
|
|
|
|
|
I have a window manager class. It maintains references to open User and Item forms:
At the top I create an array list:
private static ArrayList oWindows = new ArrayList();
The I have a method to return an instance of a form in the collection:
public void GetOpenForm(FormTypes type, int iRecordKey)
{
form oRetVal = null;
foreach(form oForm in oWindows)
{
if (oForm.iRecordKey == iRecordKey)
{
}
}
}
Problem is, the references to oForm in the code above are not User or Item forms, so the iRecordkey reference fails to compile. Add to this, the Item and User forms are not based off any single base form.
How do I make oForm "know" about iRecordKey?
Everything makes sense in someone's mind
|
|
|
|