处理在Visual Studio 2008种尺寸为.NET CF [英] Handling Different Resolutions in Visual Studio 2008 for .NET CF

查看:207
本文介绍了处理在Visual Studio 2008种尺寸为.NET CF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于图形的应用程序提供.NET CF,我的项目涉及抽签的图片,我们已经决定去移植不同的手机分辨率的应用程序。(240×240,480 * 640)等。

I am developing a .NET CF based Graphics Application, my project involves a lot of drawing images, We have decided to go for porting the application on different handset resolution.(240 X 240 , 480 X 640) etc.

我怎么会去到单一的解决方案/项目内实现这一目标?

How would i go onto achieve this within single solution/project?

是否有必要创建基于不同的项目决议?
我将如何处理常见的文件?我需要在跨所有设备出现常见的类之一的变化。

Is there a need to create different projects based on resolutions? How would i handle common files? and i need the changes in one of the common classes to occur across all devices.

感谢您,
克洛诺斯

Thank you, Cronos

推荐答案

别听那个白痴MusiGenesis。处理不同的屏幕分辨率为Windows Mobile设备更好的方法是使用形成继承,它可以上涨到以最小的努力现有的CF应用程序。

Don't listen to that idiot MusiGenesis. A much better way of handling different screen resolutions for Windows Mobile devices is to use forms inheritance, which can be tacked onto an existing CF application with minimal effort.

基本上,你设计的每个表单标准240x320的屏幕。当你需要重新安排一个新的决议形式(比方说240x240),添加一个新的形式到您的项目,并把它从原来的240×320的形式继承:

Basically, you design each form for a standard 240x320 screen. When you need to re-arrange a form for a new resolution (let's say 240x240), you add a new form to your project and have it inherit from your original 240x320 form:

public partial class frmDialog240x240: frmDialog

而不是只是形式

public partial class frmDialog240x240: Form

像往常一样。在您的原始形式,需要每个控件的设置修饰符属性来保护(而不是默认的私营)。在设计师为新的形式,你会看到所有的控件你继承的形式,并且可以移动它们并调整其大小,你认为合适,以适应新的屏幕尺寸(这不会影响原来的形式的布局)。

like usual. On your original form, you need to set the Modifiers property of each control to Protected (instead of the default Private). In the designer for your new form, you will see all of the controls on the form you're inheriting from, and you can move them and resize them as you see fit to accomodate the new screen dimensions (this will not affect the original form's layout).

当程序运行时,它很容易为它来检查它的运行对设备的屏幕分辨率,并建立适当的形式(工厂方法好为了这)。您的新形式继承了从旧的形式,但使用新的自定义布局。

When your program is running, it's easy for it to check the screen resolution of the device it's running on and create the appropriate form (a factory method is good for this). Your new form inherits everything from the old form, but uses your new custom layout.

这方法可以让你避免重复代码,因为没有任何。

This approach allows you to avoid code duplication, because there isn't any.

这篇关于处理在Visual Studio 2008种尺寸为.NET CF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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