设计具有图像大小调整和拖放功能的地图 [英] Design a map with image resize and drag&drop

查看:91
本文介绍了设计具有图像大小调整和拖放功能的地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用一张不同大小和位置的桌子来代表一张餐厅地图.用户应该能够调整每个表格的大小并指定位置(用户设计地图).我正在考虑使用一组图像来表示一张桌子(方形桌子,圆形桌子等),一个调整大小的功能(使用鼠标)并拖放以设置桌子的位置.然后,用户应该能够看到地图并单击所需的表.
重要的是要了解,并非每个屏幕都有相同的分辨率,因此每个表的位置和大小都应按实际分辨率进行缩放.
我正在使用C#和WinForms
在此先谢谢您.

I need to represent a restaurant map with tables of different sizes and location. The user should be able to resize each table and specify the location (the user designs the map). I was thinking of a set of images to represent a table (square table, circular tables, etc.), a resize function (using the mouse) and drag and drop to set the location of the table. Then, the user should be able to see the map and click on the desired table.
It''s important to understand that not every screen has the same resolution so the location and size of each table should be scaled to fit the actual resolution.
I''m using C# and WinForms
Thanks in advance.

推荐答案

您可以使用可调整大小的图形来代替使用图像.由于图形(矢量,而不是图像)保存的数据少于图像,因此操作会更快.在此处查看带有处理程序的可调整大小的图形

可调整大小的图形矩形 [
Instead of using images, you can use resizable graphics. As graphic (vector, not image) holds less data than image, operations would be faster. Take a look here for a resizable graphic with handlers

A Resizable Graphical Rectangle [^]


这不是很困难,但需要时间来设计和实现.您的扩展问题也很琐碎,因此很难提供任何建议.我可以创建一个完整的设计,但除非您雇用我,否则我无法负担,或者如果我发现您的错误,可以给您指示.到目前为止,没有错误,而且我看不到可能出什么问题.

因此,我只能提供一个建议,但提供一个重要的建议:请勿使用 System.Windows.Forms使用WPF!
您仅考虑的问题中有70%已经解决了.已经提供了缩放比例,已经提供了矢量图形,没有渲染(您将不得不花很多时间在Forms渲染中),所有图形都已经作为一组对象呈现.此外,您可以在外部矢量编辑器中创建矢量图形(一个完美的第三方工具是Inkscape),将其转换为XAML并将其放置在您的餐厅中.而且,您甚至可以允许您的用户在运行时执行此操作!还有什么?性能会好很多,独立于屏幕分辨率的设计要容易得多(正如我所说的,缩放已经固有地嵌入到了所有内容中,您甚至可以使用所有控件来缩放整个内容).

考虑到所有这些,我什至都不愿意使用Windows.Forms的想法.其他一些应用程序可能是,但不是您的应用程序. WPF正是为处理此类情况而生的.

您真的有任何令人信服的理由使用表格吗?

—SA
This is not very difficult but need time to design and implement. You scaling problem is also trivial, so it''s hard to advise anything. I could either create a complete design, but I cannot afford it unless you hire me, or I could give you instructions if I see your mistakes. So far, there are no mistakes, and I cannot see what can possibly go wrong.

So, I can give only one advice, but an important one: do not do it with System.Windows.Forms! Use WPF!
Some 70% of the problems you''re only thinking about are already solved there. Scaling is already provided, vector graphics is already provided, there is no rendering (you will have to spend good time in just Forms rendering), all graphics is already presented as set of objects. Moreover, you can create vector graphics in external vector editor (a perfect third-party tool is Inkscape), convert it to XAML and put it in your restaurant. Moreover, you can even allow your user to do that during run-time! What else? Performance will be much better, screen resolution independent design is much easier (as I say scaling is inherently embedded in everything already, you can even scale whole thing with all you controls).

Given all that, I would hate even the flirting with the idea of using Windows.Forms. Some other applications — may be, but not your applications. WPF was born to handle exactly such situations.

Do you really have any convincing reason to use Forms?

—SA


这篇关于设计具有图像大小调整和拖放功能的地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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