动态调整表格/控件/字体的大小以适应差异屏幕分辨率 [英] resize Form/controls/fonts dynamically to fit diff screen resoluti

查看:99
本文介绍了动态调整表格/控件/字体的大小以适应差异屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作场所的很多用户使用不同的屏幕分辨率,我建立

应用程序默认使用1680 x 1050像素的res。但有些用户使用800

x 600,并且应用程序对于他们的屏幕来说太大了。


几年前我曾用Java编写代码( 2005),你可以使用鼠标拉伸一个

表格,所有控件和字体都会调整为更大或更小的b
。 .Net framework 3.5是否支持这种功能?

或者 - 是否可以更改表格/控件/字体的大小,例如Google

地图?


任何建议都赞赏我如何使用VB.Net(2005/2008)处理不同的屏幕

分辨率。


谢谢,

Rich

解决方案



实际上,我很惊讶我换了几年公司

之前,实际上有程序员不关心屏幕

分辨率和设计形式只有一个标准屏幕尺寸(一些

我当前的同事)。


我设计我的所有程序以适应不同的屏幕分辨率,在

..Net你可以使用多个方便的控件来做这个(表布局pannel是

我最喜欢的一个)

但是你只需要对接并锚定你的控件就可以了。

钻机ht方式。


字体大小然而我不碰,因为它们应该是系统特定的


问候


Michel Posseth
http://www.vbdotnetcoder.com


" Rich" < Ri ** @ discuss.microsoft.comschreef in bericht

news:51 ************************** ******** @ microsof t.com ...


>我工作场所的很多用户使用不同的屏幕分辨率,而我/> build

应用程序默认使用1680 x 1050像素的res。但有些用户正在使用



x 600,并且应用程序对于他们的屏幕来说太大了。


我曾经写过几年前(2005年)用Java编写的代码,你可以使用鼠标弹出

a

表单,所有控件和字体都会调整为更大的



更小的尺寸。 .Net framework 3.5是否支持这种

功能?

或者 - 是否可以更改表单/控件/字体的大小,例如

谷歌

地图?


任何建议都赞赏我如何使用VB.Net处理不同的屏幕

分辨率(2005/2008)。


谢谢,

Rich



< blockquote>

首先,您可以在MSDN上查看此文档:
http://msdn.microsoft.com/en-us/libr...05(VS.80).aspx


但是,如果您想动态调整表单或特定控件的大小,

您可以使用Screen类来确定客户端PC的屏幕分辨率和

通过定义一个新的Size对象来调整大小:


''例如:在计算机上运行时调整窗体大小

''有800x600屏<无线电通信/>
如果Screen.PrimaryScreen.Bounds.Width = 800并且还要

Screen.PrimaryScreen.Bounds.Height = 600那么

Me.Size =新尺寸(宽度,高度)

结束如果


将代码放入Form'的加载事件中是个好主意。


当然,在应用程序自述文件中提及您的

应用程序以1060x1050分辨率最佳浏览效果也很不错。


-

祝你好运,


Onur G ?? zel


" Rich"写道:


我工作场所的很多用户使用不同的屏幕分辨率,我建立

应用程序使用1680 x 1050像素的res默认。但有些用户使用800

x 600,并且应用程序对于他们的屏幕来说太大了。


几年前我曾用Java编写代码( 2005),你可以使用鼠标拉伸一个

表格,所有控件和字体都会调整为更大或更小的b
。 .Net framework 3.5是否支持这种功能?

或者 - 是否可以更改表格/控件/字体的大小,例如Google

地图?


任何建议都赞赏我如何使用VB.Net(2005/2008)处理不同的屏幕

分辨率。


谢谢,

Rich


Onur


我刚刚开始我的表格如果我想要他们屏幕填充最大化,因为我猜你的代码在多显示器系统上有一个缺陷

如果我的主屏幕是22英寸宽屏显示器,但creen

i想要查看应用程序是一个19英寸的normall显示器


因此,一个系统有2种不同类型的显示器,在我工作的公司

这是一个常见的场景

另一个不错的一个我的开发系统有2x 22"英寸宽屏显示器,但

两个不同的屏幕分辨率(我有一个在我面前与VS和

另一个在旁边与短信)主屏幕具有更高的分辨率作为辅助屏幕的b / b
,但如果我在VS中启动应用程序,我通常会将其拖到辅助屏幕上,这样我就可以更轻松地调试应用程序
< br $>

问候


米歇尔


" kimiraikkonen" < ki *********** @ discuss.microsoft.comschreef in bericht

news:37 ***************** ***************** @ microsof t.com ...




首先,您可以在MSDN上查看此文档:
http://msdn.microsoft.com/en-us/libr...05(VS.80).aspx


但是,如果你想动态调整表单或特定控件的大小,

你可以使用Screen类来确定客户端PC的屏幕分辨率和

通过定义一个新的Size对象来调整大小像那样:


''例如:在运行时在电脑上调整表格大小

''有800x600屏幕

如果屏幕.PrimaryScreen.Bounds.Width = 800并且还要

Screen.PrimaryScreen.Bounds.Height = 600然后

Me.Size =新尺寸(宽度,高度)

结束如果


我最好把代码放入i n表单'加载事件。


当然,在应用程序自述文件中提及

你的
也很好
应用程序最好以1060x1050分辨率查看:)


-

祝你好运,


OnurGüzel


" Rich"写道:


>我工作场所的很多用户使用不同的屏幕分辨率,我建立
应用程序使用1680 x 1050像素res默认情况下。但有些用户使用的是
800
x 600,并且应用程序对于他们的屏幕来说太大了。

几年前我曾经用Java编写代码(2005),并且您可以使用鼠标拉伸
表单,并且所有控件和字体都会调整为更大的尺寸或更小的尺寸。 .Net framework 3.5是否支持这种功能?
或者 - 是否可以更改表格/控件/字体的大小,如
google
地图?

任何建议都赞赏我如何使用VB.Net(2005/2008)处理不同的屏幕分辨率。

谢谢,
Rich



A lot of users at my workplace use different screen resolutions, and I build
apps to use 1680 x 1050 pixels res by default. But some users are using 800
x 600, and the apps are too large for their screen.

I used to write code in Java a few years ago (2005), and you could stretch a
form with the mouse and all the controls and fonts would resize to larger or
smaller size. Does .Net framework 3.5 support this kind of functionality?
Or - is it possible to change the size of a form/controls/fonts like a google
map?

Any suggestions appreciated how I could deal with the different screen
resolutions with VB.Net (2005/2008).

Thanks,
Rich

解决方案


Well actually , i was verry surprised when i switched company`s a few years
ago that there actually are programmers who do not care about screen
resolutions and design forms for just one standard screen size ( a few of
my current collegues ).

I however design all my programs to fit different screen resolutions, in
..Net you can do this with multiple handy controls ( table layout pannel is
one of my favorits )
but you get pretty far with just docking and anchoring your controls the
right way .

Font sizes however i do not touch as they should be system specific

regards

Michel Posseth
http://www.vbdotnetcoder.com

"Rich" <Ri**@discussions.microsoft.comschreef in bericht
news:51**********************************@microsof t.com...

>A lot of users at my workplace use different screen resolutions, and I
build
apps to use 1680 x 1050 pixels res by default. But some users are using
800
x 600, and the apps are too large for their screen.

I used to write code in Java a few years ago (2005), and you could stretch
a
form with the mouse and all the controls and fonts would resize to larger
or
smaller size. Does .Net framework 3.5 support this kind of
functionality?
Or - is it possible to change the size of a form/controls/fonts like a
google
map?

Any suggestions appreciated how I could deal with the different screen
resolutions with VB.Net (2005/2008).

Thanks,
Rich



Hi,
First you can look at this documentation on MSDN:
http://msdn.microsoft.com/en-us/libr...05(VS.80).aspx

However, if you want to resize your form or specific control dynamically,
you can use Screen class to determine client PC''s screen resolution and
resize by defining a new Size object like that:

''eg: To resize form at runtime on computers
''that have 800x600 screen
If Screen.PrimaryScreen.Bounds.Width = 800 AndAlso
Screen.PrimaryScreen.Bounds.Height = 600 Then
Me.Size = New Size(width,height )
End If

And it''s good idea to put the code in Form''s load event.

And of course, it''s also good to mention in readme of application that your
application is best viewed in 1060x1050 resolution :)

--
Best regards,

Onur G??zel

"Rich" wrote:

A lot of users at my workplace use different screen resolutions, and I build
apps to use 1680 x 1050 pixels res by default. But some users are using 800
x 600, and the apps are too large for their screen.

I used to write code in Java a few years ago (2005), and you could stretch a
form with the mouse and all the controls and fonts would resize to larger or
smaller size. Does .Net framework 3.5 support this kind of functionality?
Or - is it possible to change the size of a form/controls/fonts like a google
map?

Any suggestions appreciated how I could deal with the different screen
resolutions with VB.Net (2005/2008).

Thanks,
Rich


Onur

I just start my forms maximized if i want them screen filling , cause i
guess your code has a flaw on a multi monitor system
what if my primary screen is a 22" inch widescreen monitor , but the creen
i want to view the app in is a 19 inch normall monitor

Thus a system with 2 different types of monitors, in the compay i work for
this is a common scenario
another nice one My dev system has 2x 22" inch widescreen monitors but with
both a different screen resolution ( i have one in front of me with VS and
another one beside with SMS ) the primary screen has a higher resolution as
the secondary screen , however if i start an app in VS i normally drag it to
the secondary screen , so i can easier debug the app


regards

Michel

"kimiraikkonen" <ki***********@discussions.microsoft.comschreef in bericht
news:37**********************************@microsof t.com...

Hi,
First you can look at this documentation on MSDN:
http://msdn.microsoft.com/en-us/libr...05(VS.80).aspx

However, if you want to resize your form or specific control dynamically,
you can use Screen class to determine client PC''s screen resolution and
resize by defining a new Size object like that:

''eg: To resize form at runtime on computers
''that have 800x600 screen
If Screen.PrimaryScreen.Bounds.Width = 800 AndAlso
Screen.PrimaryScreen.Bounds.Height = 600 Then
Me.Size = New Size(width,height )
End If

And it''s good idea to put the code in Form''s load event.

And of course, it''s also good to mention in readme of application that
your
application is best viewed in 1060x1050 resolution :)

--
Best regards,

Onur Güzel

"Rich" wrote:

>A lot of users at my workplace use different screen resolutions, and I
build
apps to use 1680 x 1050 pixels res by default. But some users are using
800
x 600, and the apps are too large for their screen.

I used to write code in Java a few years ago (2005), and you could
stretch a
form with the mouse and all the controls and fonts would resize to larger
or
smaller size. Does .Net framework 3.5 support this kind of
functionality?
Or - is it possible to change the size of a form/controls/fonts like a
google
map?

Any suggestions appreciated how I could deal with the different screen
resolutions with VB.Net (2005/2008).

Thanks,
Rich



这篇关于动态调整表格/控件/字体的大小以适应差异屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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