Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I need to make a program that has the capasity to add object permanantly to the form (unless they choose to delete it). I tried this but it does not work:

 

Control r=new RichTextBox();
		r.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
		r.Location = new System.Drawing.Point(80, 162);
		r.Name = "richTextBox3";
		r.Size = new System.Drawing.Size(520, 56);
		r.TabIndex = 3;
		r.Text = "richTextBox3";

 

And they would need the ability to move and resize them too. How would I do this?

Edited by divil
C#
  • *Gurus*
Posted

You're almost there. Your code will work, but you need to add the following line to the end:

 

Controls.Add(r);

 

As for moving and resizing, you will have to write all this logic yourself, including drawing the selection rectangles and adjusting sizes when the user drags the mouse. It's not a trivial task, but the ControlPaint class may help with some of the drawing.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Thank you. How would the user permanantly save it to the program?

 

And, when the user add a box, how would I make it so that the boxes would only go to a specific place?

 

For example: The user has a peoples names area on the form for the peoples names to be entered and all the rest is something else. How would I specifically put them in a locatioin right after the last box in that area?

C#
Posted
Would it be ok to just create a whole buch of text boxes (about 20) and just hide them. When the user wants more to go into design mode and drag them to where they want them?
C#
  • Leaders
Posted
I wouldn't want to maintain it. Why don't you do as divil suggested and provide some more details of the project and let someone help come up with a more appropriate UI design?
--tim
  • Leaders
Posted

It isn't clear what Textbox1 and textbox2 are for. Are they two separate log entries? What is button1 for on the new comm log input form?

 

btw. having variable names the same as keywords, like your "New" is not so good.

--tim
Posted

It is very unfinished.

 

The form will initiallly have about 16 Text boxes on it (includes Rich). Only 2 of them (Text Box: persons name)(Rich text box: persons information) will be 1 person initially. But that will fluxuate when more than one person is at each house. That means I'll need to add textboxes at runtime.

 

Ignore button1. I was just experimenting.

 

I am thinking that I could just create a child window for the house info. So that would be 2 separate forms that could auto scroll.

C#
Posted

That is not permanant enouph. It is rare that people will be leaving and rare that new boxes will need to be added but they will need to be addes eventually.

 

The small boxes are for their names and they will stay the same each time the program is opened (they clear now, but they won't later). When a resident of the house dies or leaves their name will be removed along with the corrosponding Rich text box.

 

But if a residnet comes to live there, 2 new boxes must be made.

 

When the user enters in info on the residents for that day it saves to a text file names as the current date. On the first form it reads that file to display it to the users.

C#

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...