复杂图表应用程序的模式或框架 [英] Pattern or Framework for Complex Diagramm Application

查看:88
本文介绍了复杂图表应用程序的模式或框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们有一个在MFC中开发的软件.我们正在使用GDI +绘制文档.输出在屏幕上是主要的,但也支持EMF,打印和导出(因为几种图像格式).由于GDI +都已完成,因此在MFC中没什么大不了的.只需为打印机,EMF,图像或其他任何设备生成设备,然后使用该设备绘制文档即可....

但是现在有了重新设计整个应用程序的想法.我们在C#方面拥有多年的经验,因此我们想使用.NET技术.仍然存在使用WPF或Windows窗体的问题.无论如何,我们现在正在使用WinForms.

我们已经制作了一个用于进行UserControl的小型框架.页面是一个UserControl,其中包含图表(也包括UserControls)或其他元素,例如TextBoxes,ImageBoxes等.对于打印,我们仅使用UserControls的.ToBitmap()方法.

| ---------------- |
| ..... page ....... ||
|.| ---- | ......... |
|.| diag | ......... |
|.| ---- | ......... |
| ................ |
| ---------------- |

使用这种方法,我们将无法创建准确的图形(直接在打印机上绘制或创建EMF).该应用程序的输出也用在打印介质中.因此必须非常准确.使用内置在Printing类中的.NET Framework意味着要对每个控件的绘图"方法进行编码.这是很多工作,GUI的实现将与印刷不同.我还发现WPF不支持WMF/EMF.另外,WinForms中的支持也很差.
由于文档的布局是由用户在运行时设计的,因此不能使用报表框架.

所以这是我的问题:
是否有任何指南,设计模式,框架或任何其他信息来构建这样的应用程序? (运行时动态布局,以EMF(或类似格式)输出,正在打印.
WMF/EMF已经很老了,但是它仍然是从应用程序获取精确图形到Office,InDesign等的唯一方法.这是正确的吗?

预先感谢您的任何建议!

Hi,

we have a Software which is developed in MFC. We are drawing documents with GDI+. The output is primary on screen but EMF, Printing and export as several image formats are supported as well. As it''s all done with GDI+ that''s no big deal in MFC. Just generate a Device for Printer, EMF, Image or whatever and draw the documents with the device....

But now there is the idea to redesign the whole application. We have several years of experience with C# so we wanna use the .NET technology. there''s still the question to use WPF or Windows Forms. Anyway at the moment we are using WinForms.

We''ve already made a small framework where UserControls take place. A page is a UserControl and contains diagrams(also UserControls) or other elements like TextBoxes, ImageBoxes, etc. For Printing we just use the .ToBitmap() method of the UserControls.

|----------------|
|.....page.......|
|.|----|.........|
|.|diag|.........|
|.|----|.........|
|................|
|----------------|

With this approach we are not able to create accurate graphics (Draw directly on the Printer or create EMF). The outputs of this applicaton is also used in Print Media --> so it has to be very accurate. Using the .NET Framework built in Printing classes would mean to code the "Drawing" method of each Control. That''s a lot of work and the implemenation of the GUI would be different from the Printing. I also found out that WMF/EMF is not supported in WPF. Also the support in WinForms is quite bad.
As the layout of the document is designed by the user at runtime, Reporting Frameworks are not an option.

So here are my question(s):
Is there any guide line, design pattern, framework or any other information to build such an application? (Dynamic layout at runtime, output as EMF (or similar), Printing.
WMF/EMF is very old, but it''s still the only way to get accurate graphics from applications into office, InDesign, etc. Is that correct?

Thanks in advance for any suggestions!

推荐答案

请参阅我对问题的评论.您可以将System.Windows.FormsSystem.Drawing和GDI +或WPF一起使用,但不能同时使用(实际上,可以使用互操作,但这不切实际).

如果您可以考虑使用WPF,我强烈建议您使用它.在设计时要考虑到许多不同的活动.图表是很好地支持的主要编程工作之一.大多数事情,例如与用户的交互,矢量图形(使用XAML,不像SVG那样通用,但在绘制图形时实际上是相同的),缩放和平移-所有这些都已实现.

请在尝试绘制图表软件设计时查看我过去的答案:
连接不同的控件 [矢量图形软件,例如C#或VB.NET中的CorelDraw或Inkscape [ ^ ],
架构图提示 [
Please see my comments to the question. You can use either System.Windows.Forms with System.Drawing and GDI+ or WPF, not all together (in fact, you can use interop, but this is not practical).

If you can consider using WPF, I would strongly recommend using it. It is designed with the support of many different activities in mind; and diagramming is one of the major programming chores supported very well. Most things like interaction with the user, vector graphics (with the use of XAML, not as universal as with SVG, but practically the same for diagramming purposes), zoom and pan — all that is already implemented.

Please see my past answers where I tried to sketch the design of diagramming software:
Connect different controls[^],
Vector graphics software like CorelDraw or Inkscape in C# or VB.NET[^],
Architecture diagram tips[^].

—SA


这篇关于复杂图表应用程序的模式或框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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