电网与帆布 [英] Grid vs. Canvas

查看:158
本文介绍了电网与帆布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找意见使用Canvas与网格面板在WPF。 我需要有基本的网格布局,经典的输入形式,有的可能有小的数据网格内,groupboxes,但在网格布局中的所有排列。我挣扎是否要使用网格或画布面板为我所有的形式。网格是给我良好的结构;我可以保持控制的更多easily¬对齐。我将有基类(即继承窗口类)的所有窗口,所以设计师在Visual Studio将是无用的,因为它有问题的这种继承,并与网格面板我真的不甚至不需要设计师,我可以设置窗口SizeToContent所以一切都将适合就好。但再次画布,我有能力,位置控制任何方式我很喜欢,而且这只是我使用Canvas时,见效益。

I'm looking for opinion on using Canvas vs. Grid panels in WPF. I need to make classic input forms that have basically grid layouts, some may have small datagrids inside, groupboxes, but all aligned in grid layout. I’m struggling whether to use Grid or Canvas panel for all my forms. Grid is giving me good structure; I can maintain alignment of controls more easily¬. I will have base class (that inherits Window class) for all windows, so designer in Visual Studio will be useless, since it has issues for this sort of inheriting, and with Grid panel I don’t really even need designer, and I can set window SizeToContent so everything will fit just fine. But again with Canvas, I have ability to position controls any way I like, and this is only benefit I see when using Canvas.

我没有那么多的WPF为predict在什么样的问题,我可以从布局客户要求获得经验。 Web表单上我有时用绝对定位的方式,以防万一顾客有一些特殊的请求是否有控制像素向右或向左更高等大家都用苛刻的客户明白我的意思的工作。

I didn’t have that much of experience in WPF to predict on what sorts of problems could I get from customer requests on layout. On web forms I sometimes use absolute positioning for forms just in case customer has some "special" request whether to have control pixel right or left on higher etc. everyone worked with demanding customers know what I mean.

我倒要看看你怎么想,什么是业务申请表格布局建设利弊两者兼而有之?为什么是其中一个比另一个更好吗?任何情况下,一个面板是不好用,和其他不?什么是一个面板的另一个缺点是什么?你会用什么屏?

I’d like to see what you think, what are pros and cons for both in business application form layout building? Why is one better than the other? Any cases where one panel would be bad to use, and other not? What are disadvantages of one panel to another? What panel would you use ?

感谢

推荐答案

画布大多用于自定义绘制功能,比什么都重要。网格是绝对可以自定义你的布局是最好的选择。

Canvas is mostly intended for custom drawing functionality more than anything else. The grid is definitely the best choice available for customizing your layout.

这篇关于电网与帆布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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