0

He I am a beginner to C# and I am working on a reaction manager plug-in for some bigger project. (Yes I am a intern)

Now I just can't find a way to create a view similar to this:

enter image description here

My full design:

enter image description here

How to realize this design? I cant find any default templates in the devexpress which are suitable for this. I come from php and in php I can use html. I am a beginner to C# and I don't have any clue on how t do this. Do I have to use canvas to literally draw this? OR is there a standard template I can use for this purpose.

4

1 回答 1

1

您有许多包含相同布局的评论框 - 标签评论文本、作者姓名、日期等。没有控件可以像这样布置,您必须制作自己的自定义控件(项目->添加用户控件)。该控件将是一个复合控件——即由​​其他控件组成。可能每个文本字段(评论、作者、日期等)的标签都放置在正确的位置。也许称它为 CommentBox 之类的。

然后在主窗体中,您现在有可用的 CommentBox 控件,您可以将其添加到窗体中。创建一个面板来放置它们,这样您就可以在面板中有许多 CommentBox 控件,每个评论一个(或者可能在运行时添加它们)。

现在在 WPF 中稍微容易一些,因为有一个StackPanel 控件,您可以简单地向其中添加控件,它会自动将它们垂直排列在堆叠列表中的另一个下方。事实上,您的用例完全符合 StackPanel 的用途。

在 WinForms 中没有 StackPanel,但您可以使用普通的 Panel 控件*。只是您必须手动将 CommentBox 控件置于另一个之下。如果内容不适合视图,您还需要将 AutoScroll 属性设置为 true 以打开垂直滚动条。

*或者显然有另一种选择如何在 WinForms 中获得类似 StackPanel 的布局

于 2013-11-19T15:17:01.090 回答