Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi friends,
I am working on Visual Studio 2008, in C#, but I am unable to create a user control. I am making a word processor for which i need to build a ruler component[with tab and page margins facilities] for the rich text box. Can anyone help me? you can also mail me at [email removed]
Posted
Updated 5-Aug-11 6:08am
v2
Comments
[no name] 5-Aug-11 12:09pm    
Don't include your email. You posted the question here for all so the responses should also be available to all
[no name] 5-Aug-11 12:09pm    
What environment, Windows or Web?
Ritwesh 5-Aug-11 12:33pm    
In windows environment.
BillWoodruff 5-Aug-11 13:37pm    
Hi, Please say more about exactly what is happening in Visual Studio. Assuming you have a WinForms project/solution open: what happens when you go to the Project menu, and choose to add a UserControl to the Project ?
Ritwesh 6-Aug-11 12:52pm    
In my WinForm project I have a child form in which i have a Rich Text Box component and other menustrips and toolstrips. For my Rich Text Box component i want to build up a ruler component which has the facilities to set up the tabs[for all-left,right,center and justified alignment] and page margins.

1 solution

Ritwesh wrote: "I want help in designing a Ruler UserControl."

Okay, now that we know there is no problem with creating a UserControl here, you can start to work on specifying the functionality and appearance required for your Ruler.

Here are some issues, from general to specific, that come immediately to mind:

general:

1. the overall architecture of your word-processor;

a. one document at a time in one main windows(SD), or multiple documents within a 'master-container' Form (MDI), or multiple documents accessible as Tabs in a 'master-container' Form (tabbed MDI) ?

Or, as in many modern big-applications, multiple documents in independent windows running in one application (SDI).

b. the design of your data-structures for how you keep track of document(s), Ruler settings, within Ruler settings tabs and tab-positions.

2. Visual presentation of Ruler(s)

a. within one document (one editor), can there be more than one Ruler displayed: can you set tabs independently within different sections of the document the user has selected using the Ruler, or in any other way ?

b. another way of asking this question ... assuming only one Ruler is displayed per document being edited ... is to ask if you can set tab-settings for any arbitrary user-selection of text within the document being edited.

c. note this question also goes to Ruler location: you could choose to have only one Ruler displayed per edited document, but ... on user action ... display it at the start of the Text the user has selected ... that's assuming you are allowing, as in 2.b, to have multiple tab settings within one document.

more specific:

1. the visual relationship of the Ruler to the document being edited:

a. is the Ruler a UserControl contained within the Document's container, or within a separate Window ? If it's in a separate window, can that window 'float,' or can it be 'docked' to specific sides of the document container, or does the ruler 'lock in place' at the top of the document ?

b. if the Ruler is a UserControl contained in the same container as the Document(s) being edited, then: same questions about location, and whether it can be moved, as in 1.a.

getting down to the code:

1. in all of the cases above, let's assume that the user moves some kind of ui element on the Ruler to set tabs, and those setting then take effect on either the entire document being edited, or some section of the document being edited.

a. what is your code strategy for the interaction of Ruler and document, and/or the interaction of Ruler and Application.

imho if you make a detailed outline of the functionality you require ... and don't require ... and then plan your data-structures, and then outline the interaction and event management strategy between Ruler and Document, and Document and Application, you'll be in a good place to deal with the specifics of Ruler design.

And, there are good resources here on CodeProject to help you, such as "Advanced Text Editor with Ruler by Aleksei Karimov."

Studying what's here on CP, and creating a prototype, and then asking questions here, as issues arise with your prototype, might be a good plan, while very general questions will probably not be as 'fruitful.'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900