问题描述
在工厂,我们有尺寸范围的显示器,我们强制我们的
应用程序全屏。
屏幕的字体设计用于800x600屏幕,这是我们在这里使用的最小尺寸分辨率。
但是,每当有人在显示器上运行表格时分辨率
设置得更高(如1600x1200),文字太小,无法从远处读取。
有一种简单的方法可以告诉应用程序适合屏幕宽度
而不必进入每个控件并为它们设置所有字体?
谢谢,
Joe
使用Visual Studio 2005
嗯,首先想到的是,你可以确定当前计算机的屏幕
大小如果它大于800x600则通过实例化控件的新字体对象将字体大小增加到
合理级别
像form_load事件一样:
''----------------------------
''为此目的使用Screen Class
For Each ct rl As Control In Me.Controls
如果Screen.PrimaryScreen.Bounds.Height.ToString 600 _
AndAlso Screen.PrimaryScreen.Bounds.Width 800那么
''例如:如果大于800x600,将Button'的字体大小增加到25
ctrl.Font = New Font(Arial,25)
结束如果
下一页
''---------------------------
希望这个有效,
OnurGüzel
我想要添加与我之前的帖子相关的内容,但是它也可以增加Form'的字体大小,因为它完成了
它适用于表单上的所有控件,你不会担心由于新的放大字体而导致控件尺寸适合的问题。
>
所以,你也可以考虑:
''------------------------ ----
''为此目的使用屏幕类
如果Screen.PrimaryScreen.Bounds.Height.ToString 600 _
AndAlso Screen .PrimaryScreen.Bounds.Width 800然后
''例如:如果大于800x600,将Button的字体大小增加到20
''引用当前表单实例
Me.Font =新字体(Arial,20)
结束如果
''---------- -----------------
BTW,不要忘记当你增加表格的'字体大小,形式''自己的
大小也会b根据你指定的字体大小值,你需要更大的
。
OnurGüzel
也许您应该考虑购买可以显示的新显示器
1280x1024。如果您为该分辨率设计了应用程序,那么
对1600x1200没有任何问题。
祝你好运,
Martin
In the plant, we have monitors that range in size, and we force our
application to be full screen.
The font for the screen has been designed for 800x600 screens, which is the
smallest size resolution that we use here.
However, whenever someone runs the form on a monitor that has the resolution
set higher (like 1600x1200), the text is too small to be read from a distance.
Is there a simple way to tell the application to fit the screen width
without having to go into each control and setting the fonts for them all?
Thanks,
Joe
Using Visual Studio 2005
Well, at first thought, you can determine current computer''s screen
size and if it''s larger than 800x600 then increase the font size to a
reasonable level by instantiating a new font object of the controls
like this on form_load event:
''----------------------------
'' Use Screen Class for that purpose
For Each ctrl As Control In Me.Controls
If Screen.PrimaryScreen.Bounds.Height.ToString 600 _
AndAlso Screen.PrimaryScreen.Bounds.Width 800 Then
'' eg: If larger than 800x600, increase Button''s font size to 25
ctrl.Font = New Font("Arial", 25)
End If
Next
''---------------------------
Hope this works,
Onur Güzel
Well, at first thought, you can determine current computer''s screen
size and if it''s larger than 800x600 then increase the font size to a
reasonable level by instantiating a new font object of the controls
like this on form_load event:
''----------------------------
'' Use Screen Class for that purpose
For Each ctrl As Control In Me.Controls
If Screen.PrimaryScreen.Bounds.Height.ToString 600 _
AndAlso Screen.PrimaryScreen.Bounds.Width 800 Then
'' eg: If larger than 800x600, increase Button''s font size to 25
ctrl.Font = New Font("Arial", 25)
End If
Next
''---------------------------
Hope this works,
Onur Güzel
I want to make addition related to my previous post, however it would
also be possible to just increase Form''s Font size because when done
it applies on all the controls on the form and you wouldn''t worry for
the controls'' size-fitting problems because of new enlarged font.
So, you can also consider:
''----------------------------
'' Use Screen Class for that purpose
If Screen.PrimaryScreen.Bounds.Height.ToString 600 _
AndAlso Screen.PrimaryScreen.Bounds.Width 800 Then
'' eg: If larger than 800x600, increase Button''s font size to 20
'' Referring current form instance
Me.Font = New Font("Arial", 20)
End If
''---------------------------
BTW, don''t forget that when you increase form''s font size, form''s own
size also will be bigger depending on the font size value you
specified.
Onur Güzel
Maybe you should consider to buy new monitors which could display about
1280x1024. If you designed your application for that resolution you
would have no problem with 1600x1200.
Best regards,
Martin
这篇关于比例表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!