无法创建用户控件 [英] Unable to create an user control

查看:93
本文介绍了无法创建用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,
我正在使用C#开发Visual Studio 2008,但是无法创建用户控件.我正在制作一个文字处理器,为此我需要为富文本框构建一个标尺组件[具有制表符和页面边距功能].谁能帮我?您也可以通过[电子邮件删除]

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]

推荐答案

Ritwesh写道:我需要设计标尺UserControl的帮助."

好的,现在我们知道在这里创建UserControl没问题,您可以开始指定标尺所需的功能和外观.

从一般到具体,以下是一些立即想到的问题:

一般:

1.文字处理器的整体架构;

一个.在一个主窗口(SD)中一次显示一个文档,或者在主容器"表单(MDI)中一次显示多个文档,或者在主容器"表单中以选项卡形式访问多个文档(选项卡式MDI) ?

或者,就像在许多现代的大型应用程序中一样,一个应用程序(SDI)中运行的独立窗口中有多个文档.

b.数据结构的设计,以便您了解如何在标尺设置"选项卡和选项卡位置内跟踪文档,标尺设置.

2.标尺的视觉呈现

一个.在一个文档(一个编辑器)中,是否可以显示一个以上的标尺:您可以在用户使用标尺选择的文档的不同部分中独立设置选项卡,还是以其他方式设置?
b.提出此问题的另一种方法...假设每个正在编辑的文档仅显示一个标尺...是询问您是否可以为正在编辑的文档中的任意用户选择文本设置制表符设置.

C.请注意,这个问题也涉及到标尺位置:您可以选择每个编辑的文档仅显示一个标尺,但是...根据用户操作...在用户选择的文本开头显示该标尺... s假定您像在2.b中一样允许在一个文档中具有多个选项卡设置.

更具体:

1.标尺与正在编辑的文档的视觉关系:

一个.标尺是包含在Document的容器中还是单独的Window中的UserControl?如果在单独的窗口中,该窗口可以浮动",还是可以停靠"到文档容器的特定侧面,或者标尺是否在顶部锁定"?文档的内容?

b.如果标尺是与要编辑的文档包含在同一容器中的UserControl,则:关于位置以及是否可以移动的相同问题,如1.a.

深入了解代码:

1.在上述所有情况下,我们假设用户在标尺上移动了某种ui元素以设置选项卡,然后这些设置将对整个正在编辑的文档或文档的某些部分生效正在编辑.

一个.您用于标尺和文档的交互和/或标尺和应用程序的交互的代码策略是什么?

恕我直言,如果您对功能进行了详细概述,则不需要……然后再计划数据结构,然后概述标尺与文档,文档与应用程序之间的交互和事件管理策略,那么您将是应对标尺设计细节的好地方.

并且,CodeProject上有很多资源可以为您提供帮助,例如"Aleksei Karimov的Ruler高级文本编辑器".

研究CP上的内容并创建原型,然后在原型出现问题时在此处提出问题可能是一个不错的计划,而非常笼统的问题可能不会那么富有成果".
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.''


这篇关于无法创建用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆