Moving a rich text box in C#

I need to be able to move a rich text box in C# when clicked on a menu

Page 1 of 1

3 Replies - 6201 Views - Last Post: 17 April 2009 - 02:47 PM Rate Topic: -----

#1 racso329  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 17-April 09

Moving a rich text box in C#

Post icon  Posted 17 April 2009 - 01:30 PM

I am trying to make a little basic program but dont understand how to move the rich text box. I am to have three things on the menu strip Open, tool, help. when I click open it opens the file that I choose, which is a specific file not multiple files displays a box that says file is opened and puts the contents of the file in the rich text box. The contents are a bunch of text. the tool had move and back as a sub menu strip and it moves the rich text box to the right and back moves it back to the original position. address of the assignment


http://www.cs.gsu.ed...6/assign_6.html

Is This A Good Question/Topic? 0
  • +

Replies To: Moving a rich text box in C#

#2 lesPaul456  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 173
  • View blog
  • Posts: 729
  • Joined: 16-April 09

Re: Moving a rich text box in C#

Posted 17 April 2009 - 01:48 PM

Hello,

Here's one way:

At the top of the class, define a new int called originalPosition ("int originalPosition;")

Then, in the class constructor ("public form1()") set the value of the int to the rich text box's current position ("originalPosition = richTextBox1.Left;")

Now, in the "Move" menu item's click event, add this: "richTextBox1.Left = 100;".
Change "100" to whatever position looks best on your form.

In the "Back" menu item's click event, add this: "richTextBox1.Left = originalPosition;"

This is just an idea, and so it's not perfect.

Hope this helps!
Was This Post Helpful? 1
  • +
  • -

#3 racso329  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 17-April 09

Re: Moving a rich text box in C#

Posted 17 April 2009 - 02:21 PM

View PostlesPaul456, on 17 Apr, 2009 - 12:48 PM, said:

Hello,

Here's one way:

At the top of the class, define a new int called originalPosition ("int originalPosition;")

Then, in the class constructor ("public form1()") set the value of the int to the rich text box's current position ("originalPosition = richTextBox1.Left;")

Now, in the "Move" menu item's click event, add this: "richTextBox1.Left = 100;".
Change "100" to whatever position looks best on your form.

In the "Back" menu item's click event, add this: "richTextBox1.Left = originalPosition;"

This is just an idea, and so it's not perfect.

Hope this helps!

Thanks SOOOOOOOOO much that helped out a lot I have a question about putting the contents of a file in a rich text box can you help me?
Was This Post Helpful? 0
  • +
  • -

#4 lesPaul456  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 173
  • View blog
  • Posts: 729
  • Joined: 16-April 09

Re: Moving a rich text box in C#

Posted 17 April 2009 - 02:47 PM

Quote

Thanks SOOOOOOOOO much that helped out a lot I have a question about putting the contents of a file in a rich text box can you help me?


Your welcome. I just answered your second question in your other post.

Good Luck!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1